1 Ch 4, Ex: 20

Using R, provide the solution for any exercise in either Chapter 4 or Chapter 7 of the calculus textbook

Compute the differential \(dy\) for \(y = (2x + \sin x)^2\)

\[\begin{align} dy &= f'((2x + \sin x)^2)dx \\ &= 2(2x + \sin x) \cdot (2 + \cos x)\\ &= 8x + 4\sin x + 4x\cos x + 2\sin x \cos x\\ &= 8x + 4\sin x + 4x\cos x + \sin(2x) \end{align}\]

library(Deriv)
fn1 <- function(x){
    (2*x + sin(x))^2
}
fn1prime <- Deriv(fn1)
fn1prime
## function (x) 
## 2 * ((2 * x + sin(x)) * (2 + cos(x)))

2 Ch 4, Ex: 21

Compute the differential \(dy\) for \(y = x^2e^{3x}\)

\[\begin{align} dy &= f'(x^2e^{3x})dx \\ &= (2x \space e^{3x} + x^2 \space 3e^{3x}) \\ &= x(2 + 3x)e^{3x} \end{align}\]

library(Deriv)
fn2 <- function(x){
    x^2 * exp(1)^(3*x)
}
f2prime <- Deriv(fn2)
f2prime
## function (x) 
## {
##     .e1 <- 2.71828182845905^(3 * x)
##     x * (2 * .e1 + 3 * (.e1 * x))
## }