(1) write program to compute derivative of:

\[f(x) = x^3 + 2x^2\]

myderv <- function (x) {
  h = 1e-6
  f_x <- x^3 + 2*x^2
  f_x_h <- (x + h)^3 + 2*(x + h)^2
  f_derv_x <- (f_x_h - f_x) / h
  return(f_derv_x)
}

myderv(5)
## [1] 95.00002

(2) Write a program to compute the area under the curve for the function in the range x = [1,3] :

\[3x^2 + 4x\]

interval <- (1e-6)
itr <- (3-1)/(1e-6)

area <- length(1:itr) * (3*interval^2 + 2*interval)

x_dev <- sapply(1:itr, function(x) myderv(1e-6) )
sum(x_dev)
## [1] 12.00001

We will use this form to solve integration by parts \[\lmoustache udv = uv - \lmoustache vdu\]

(3) Use integration by parts to solve for:

\[\lmoustache sin(x)cos(x)dx\] We know derivative of sin(x) is cos(x)dx therefore we get, \[u = sin(x), du = cos(x)dx\] \[\lmoustache udu = \frac{1}{2}u^{2} + C\] \[ = \frac{1}{2}sin^2(x) + C\]



(4) Use integration by parts to solve for

\[\lmoustache x^2e^2dx\] \[u = x^2, dv = e^xdx, du = 2xdx, v=2e^x\] \[\lmoustache udv = x^2e^x - \lmoustache 2e^x.2xdx\] We do integration by parts on \[\lmoustache 2e^x.2xdx\] \[u = 2x, du = 2dx, v=e^x, dv=e^xdx\] \[= 2xe^x -2e^x\]

Full Solution: \[\lmoustache x^2e^2dx = x^2e^x - 2xe^x -2e^x + C\]



(5) What is

\[\frac{d}{dx}(xcos(x))\]

By applying product of function, we get \[\frac{d}{dx}(xcos(x))=(\frac{d}{dx}x)cos(x) + x(\frac{d}{dx}cos(x))+ \] \[= cos(x) - xsin(x)\]



(6) What is

\[\frac{d}{dx}e^{x^4}\] \[=4x^3e^4\]