Computational Mathematics - Functions of Several Variables

Euclides Rodriguez

2022-05-12

Introduction

Exercises in multivariable functions.

Libraries

library(Deriv)

Chapter 12, Section 3, Problem 9

Find the partial derivatives \(f_x\), \(f_y\), \(f_{xx}\), \(f_{yy}\), \(f_{xy}\),and \(f_{yx}\) \[ f(x,y) = x^2y+3x^2+4y-5\]

fx <- function(x){x^2*y+3*x^2+4*y-5}
fy <- function(y){x^2*y+3*x^2+4*y-5}
f_x <- Deriv(fx)
f_x
## function (x) 
## 2 * (x * (3 + y))
f_xy <- Deriv(function(y)fx)
f_xy
## function (y) 
## 0
f_xx <- Deriv(f_x)
f_xx
## function (x) 
## 2 * (3 + y)
f_y <- Deriv(fy)
f_y
## function (y) 
## 4 + x^2
f_yx <- Deriv(function(x)fy)
f_yx
## function (x) 
## 0
f_yy <- Deriv(f_y)
f_yy
## function (y) 
## 0

Reference: Apex Calculus, Gregory Hartman, Ph.D

Plot of a Mutivariable Function

\[f(x,y) = \frac{7xy}{e^{x^2+y^2}}\]

multi_var_fxy <- function(x, y){7*x*y/(exp(x^2+y^2))}
 
# prepare variables.
x <- y <- seq(0, 2, length = 30)
z <- outer(x, y, multi_var_fxy)
 
# plot the 3D surface
persp(x, y, z)