\(~\)
\(~\)
\(~\)
\(f(x,y) = x^2y − x + 2y + 3\) at (1,2)
# Exercise 5
f5 <- expression((x**2*y) - x + 2*y + 3)
x <- 1
y <- 2
fx5 <- D(f5, "x")
fx5
## 2 * x * y - 1
fy5 <- D(f5, "y")
fy5
## x^2 + 2
eval(fx5)
## [1] 3
eval(fy5)
## [1] 3
\(~\)
\(f(x,y) = x^3 − 3x + y^2 −6y\) at (−1,3)
# Exercise 6
f6 <- expression(x**3 - 3*x + y**2 - 6*y)
x <- -1
y <- 3
fx6 <- D(f6, "x")
fx6
## 3 * x^2 - 3
fy6 <- D(f6, "y")
fy6
## 2 * y - 6
eval(fx6)
## [1] 0
eval(fy6)
## [1] 0
\(~\)
\(f(x,y) = sinycosx\) at (π/3,π/3)
# Exercise 7
f7 <- expression((sin * y) * (cos * x))
x <- (pi / 3)
y <- (pi / 3)
fx7 <- D(f7, "x")
fx7
## (sin * y) * cos
fy7 <- D(f7, "y")
fy7
## sin * (cos * x)
# Had to comment out eval() because I was getting Error in sin * y : non-numeric argument to binary operator
#eval(fx7)
#eval(fy7)
\(~\)
\(f(x,y) = ln(xy)\) at (−2,−3)
# Exercise 8
f8 <- expression(log(x*y))
x <- -2
y <- -3
fx8 <- D(f8, "x")
fx8
## y/(x * y)
fy8 <- D(f8, "y")
fy8
## x/(x * y)
eval(fx8)
## [1] -0.5
eval(fy8)
## [1] -0.3333333
\(~\)
There is always more than one way to approach a problem and verifying with R helps when you are doing a problem by hand.
Refresher course for linear algebra
Helpful to learn and use for real world problems.