((64*x * y^(−2)/(x^(−2) * y))^(−1/2) = (4*x/y)^(-3/2)
f<-function(x){(x+5)^(1/2)}
g<-function(x){(3/x)}
multiply=function(f,g){
function(x){f(x)*g(x)}
}
h=multiply(f,g)
h(4)
## [1] 2.25
break-even points: R(x) = C(x) <=> R(x)-C(x) = 0
=> R(x)-C(x) = 24.2x + 0.2x^2 - 13x - 147 => R(x)-C(x) = 0.2x^2 + 11.2x -147
quadratic equation: 0.2x^2 + 11.2*x -147 = 0 , (a,b,c) = (0.2,11.2,-147)
fact_quad_eqt <- function(a,b,c){
if(discr(a,b,c)==0) {
return(list(x=-b/(2*a)))
} else if(discr(a,b,c)>0) {
return(list(x1=(-b+sqrt(discr(a,b,c)))/(2*a), x2=(-b-sqrt(discr(a,b,c)))/(2*a)))
} else {
return("no roots.")
}
}
discr <- function(a,b,c) {
return((b*b)-(4*a*c))
}
fact_quad_eqt(0.2,11.2,-147)
## $x1
## [1] 10.97435
##
## $x2
## [1] -66.97435
library(Deriv)
f=function(x){9*x^(8.2)}
Deriv(f)
## function (x)
## 73.8 * x^7.2
library(Deriv)
f=function(x){-4*x^5 -3*x^4 -4*x^3 -3}
Deriv(f)
## function (x)
## -(x^2 * (3 * (4 + x * (3 + 4 * x)) + x * (3 + 8 * x)))
Let’s use Pythagoras theory: a^2 + b^2 = c^2
at time = 0: a^2 + b^2 = (4264)^2 => b = [(4264)^2 - (3480)^2]^(1/2) = 2464 feet
at moving down: 2a(da/dt) + 2b(db/dt) = 0 => given_speed = (da/dt) = -(b/a)*(db/dt)
# a=3480, b=2464, given_speed=2 ft/sec
speed=function(a,b,given_speed){
return(-(b/a)*given_speed)
}
speed(3480,2464,2)
## [1] -1.416092
f<-function(x){(3*x^8 -x^5)/(2*x^8 +2)}
# f=g/h => f'= (h*g'-h'*g)/h^2
library(Deriv)
answer<-Deriv(f)
answer
## function (x)
## {
## .e1 <- x^8
## .e3 <- 2 + 2 * .e1
## .e4 <- x^3
## x^4 * ((3 * .e4 - 1) * (5 - 16 * (.e1/.e3)) + 9 * .e4)/.e3
## }
Step 1:
f<-function(x){4*x + 25*x^(-1)}
answer<-Deriv(f)
answer
## function (x)
## 4 - 25/x^2
Critical values are (0 and 5/2): f’(0) = infinity or undefined, f’(x)=0 => x=5/2.
Step 2:
#f<-function(x) 4*(5/2) + 25*(5/2)^(-1)
f<-function(x){4*x + 25*x^(-1)}
f(5/2)
## [1] 20
The local extrema as an ordered pair is (5/2, 20).
y<-function(x){-9*(-3*x^3 + 3*x + 6)^2 + 7*(-3*x^3 + 3*x + 6) + 4}
# y' = dy/dx = (dy/du)*(du/dx) = (-18*u + 7)*(-9*x^2 + 3) = (-18*(−3*x^3 + 3*x + 6) + 7)*(-9*x^2 + 3) = (54*x^3 - 54*x -108 + 7)*(-9*x^2 + 3) = (54*x^3 - 54*x -101)*(-9*x^2 + 3)
# y'(1) = 606
a<-Deriv(y)
a(1)
## [1] 606
Step 1:
library(Deriv)
f<-function(x){(x + 5)*(x + 4)^2}
f(-4)
## [1] 0
f(-13/3)
## [1] 0.07407407
deriv1=Deriv(f)
deriv1
## function (x)
## (2 * (5 + x) + 4 + x) * (4 + x)
deriv2=Deriv(deriv1)
deriv2
## function (x)
## 2 * (5 + x) + 3 * (4 + x) + 4 + x
Step 2:
f'(x) = (2 * (5 + x) + 4 + x) * (4 + x) = (10+2x+4+x)*(4+x) = (14+3x)(4+x) = 56 + 26x + 3x^2
56 + 26x + 3x^2 = 0 => x = -14/3, x = -4
Intervals are:
1) x < -14/3 => f'(-5) = 1 > 0 => increasing
2) -14/3 < x < -4 => f'(-9/2) = -1/4 < 0 => decreasing
3) x > -4 => f'(-3) = 5 > 0 => increasing
Step 3:
f''(x) = 2 * (5 + x) + 3 * (4 + x) + 4 + x = 10+2x+12+3x+4+x = 6x+26 = 2(3x+13)
x = -13/3
At intervals:
1) f''(x) < 0 f(x) concave down
2) f''(x) > 0 f(x) concave up
Step 4:
f(-14/3) = 4/27 => (-14/3, 4/27) local maxima
f(-4) = 0 => (-4, 0) local minima
f(-13/3) = 2/27 => (-13/3, 2/27) inflection point
Step 1:
f<-function(x){-7*x^2-84*x-140}
deriv1<-Deriv(f)
deriv1
## function (x)
## -(14 * x + 84)
deriv2<-Deriv(deriv1)
deriv2
## function (x)
## -14
f(-6)
## [1] 112
Step 2:
f'(x) = -(14 * x + 84) => -(14 * x + 84)=0 => x=-6 < 0 => f(-6) = 112 => (-6,112) maximum point
f"(x) < 0 => 2nd derivative always negative it means f(x) is concave down
Let x = number of orders per year ls = lot size = 100/x f(x) = ls . (1.60) + x . 15 = 160/x + 15x
f<-function(x){160/x + 15*x}
deriv1<-Deriv(f)
deriv1
## function (x)
## 15 - 160/x^2
deriv2<-Deriv(deriv1)
deriv2
## function (x)
## 320/x^3
f(3.26)
## [1] 97.97975
f’(x) = deriv1 = 0 => 15 - 160/x^2 = 0 => x = (160/15)^(1/2) => x = 3.26 and x = -3.26 => accept only positive number of orders => x = 3.26
f“(x) = deriv2 = 320/x^3 => f”(3.26) = 9.24 > 0 minimal point
f(3.26) = 98 => x = 3 (rounded number of orders)
The beauty supply store will minimize the inventory costs with: x = number of orders per year = 3, ls = lot size = 100/x = 100/3 = 33 items per lot
y<-function(x){18*x/log(x^4)}
dy<-Deriv(y)
dy
## function (x)
## {
## .e1 <- 4 * log(x)
## 18 * 1/.e1 - 72/.e1^2
## }
f<-function(x){-5*x^3*e^x}
#Step1:
#-----
deriv1<-Deriv(f)
deriv1
## function (x)
## {
## .e1 <- e^x
## -(5 * (x^2 * (3 * .e1 + .e1 * x * log(e))))
## }
#Step2:
#-----
deriv2<-Deriv(deriv1)
deriv2
## function (x)
## {
## .e1 <- e^x
## .e2 <- log(e)
## .e4 <- .e1 * x * .e2
## -(5 * (x * ((2 * .e1 + .e4) * (3 + x * .e2) + .e4)))
## }
f<-function(x){8*((8*x + 5)^(2))^(1/3)}
integrate(Vectorize(f), lower = -3, upper = 1)
## 124.2966 with absolute error < 0.002
integrate
## function (f, lower, upper, ..., subdivisions = 100L, rel.tol = .Machine$double.eps^0.25,
## abs.tol = rel.tol, stop.on.error = TRUE, keep.xy = FALSE,
## aux = NULL)
## {
## f <- match.fun(f)
## ff <- function(x) f(x, ...)
## limit <- as.integer(subdivisions)
## if (limit < 1L || (abs.tol <= 0 && rel.tol < max(50 * .Machine$double.eps,
## 5e-29)))
## stop("invalid parameter values")
## if (is.finite(lower) && is.finite(upper)) {
## wk <- .External(C_call_dqags, ff, rho = environment(),
## as.double(lower), as.double(upper), as.double(abs.tol),
## as.double(rel.tol), limit = limit)
## }
## else {
## if (anyNA(lower) || anyNA(upper))
## stop("a limit is NA or NaN")
## if (is.finite(lower)) {
## inf <- 1L
## bound <- lower
## }
## else if (is.finite(upper)) {
## inf <- -1L
## bound <- upper
## }
## else {
## inf <- 2L
## bound <- 0
## }
## wk <- .External(C_call_dqagi, ff, rho = environment(),
## as.double(bound), inf, as.double(abs.tol), as.double(rel.tol),
## limit = limit)
## }
## res <- wk[c("value", "abs.error", "subdivisions")]
## res$message <- switch(wk$ierr + 1L, "OK", "maximum number of subdivisions reached",
## "roundoff error was detected", "extremely bad integrand behaviour",
## "roundoff error is detected in the extrapolation table",
## "the integral is probably divergent", "the input is invalid")
## if (wk$ierr == 6L || (wk$ierr > 0L && stop.on.error))
## stop(res$message)
## res$call <- match.call()
## class(res) <- "integrate"
## res
## }
## <bytecode: 0x7ff8327a6358>
## <environment: namespace:stats>
dy/dx = 4*(3+y)
dy/(3+y) = 4*dx
∫dy/(3+y) = ∫4*dx
ln|3+y| = 4x + C, where C=constant
3+y = +- e^(4x+C)
y = C'e^4x - 3, where C'= + or - constant
f<-function(x){(238+(298/sqrt(x)))*x}
#f(137)
#f(232)
#(f(232)-f(137))/(232-137)
deriv1<-Deriv(f)
#deriv1
deriv1(137)
## [1] 250.7299
deriv1(232)
## [1] 247.7823
deriv1(232)-deriv1(137)
## [1] -2.9476
If the production increases from 137 to 232 units weekly, there’s a decrease of 3 dollars per unit.
f<-function(x){sqrt(4*x-3)}
deriv1<-Deriv(f)
deriv2<-Deriv(deriv1)
deriv3<-Deriv(deriv2)
deriv4<-Deriv(deriv3)
deriv5<-Deriv(deriv4)
f(1)
## [1] 1
#deriv1
deriv1(1)
## [1] 2
#deriv2
deriv2(1)
## [1] -4
#deriv3
deriv3(1)
## [1] 24
#deriv4
deriv4(1)
## [1] -240
#deriv5
deriv5(1)
## [1] 3360
Taylor polynomial:
T(x) = f(1) + deriv1(1)(x-1) + (deriv2(1)(x-1)^2)/2! + (deriv3(1)(x-1)^3)/3! + (deriv4(1)(x-1)^4)/4! + (deriv5(1)(x-1)^5)/5!
T(x) = 1 + 2(x-1) - (4(x-1)^2)/2 + (24(x-1)^3)/6 - (240(x-1)^4)/24 + (3360(x-1)^5)/120