library(Deriv)
#2
f1=function(x)8*x^3+7*x^2-5
f1(3)
## [1] 274
f1(-2)
## [1] -41
#4
f2=function(x)-2*x^3
Deriv(f2)
## function (x) 
## -(6 * x^2)
#5
f3=function(x)-8/x^2
Deriv(f3)
## function (x) 
## 16/x^3
#6
f4=function(x)5*x^1/3
Deriv(f4)
## function (x) 
## 1.66666666666667
#7
f5=function(x)-2*x^9/8
Deriv(f5)
## function (x) 
## -(2.25 * x^8)
#10
f6=function(x)(-2*x^-2+1)*(-5*x+9)
Deriv(f6)
## function (x) 
## 4 * ((9 - 5 * x)/x^3) - 5 * (1 - 2/x^2)
#11.
myf=function(x)(5*x^1/2+7)/(-x^3+1)
Deriv(myf)
## function (x) 
## {
##     .e1 <- 1 - x^3
##     (2.5 + 3 * (x^2 * (5 * x/2 + 7)/.e1))/.e1
## }
#12.
f7=function(x)(3*x^-3-8*x+6)^4/3
Deriv(f7)
## function (x) 
## -(1.33333333333333 * ((3/x^3 + 6 - 8 * x)^3 * (8 + 9/x^4)))
#28
library(mosaic)
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: lattice
## Loading required package: ggplot2
## Loading required package: mosaicData
## Loading required package: Matrix
## 
## The 'mosaic' package masks several functions from core packages in order to add additional features.  
## The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cov, D, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
#f28= function(y) -5*(log(y))^3/y
#antiD(-5*(log(y))^3/y)

#32
fun=function(x)x*((x+7)^1/2)
integrate(fun,-7,2)
## -20.25 with absolute error < 4.1e-13
#Solve for x
A=matrix(c(1,2,-1,2,1,1,-3,-3,2),3,3)
B=matrix(c(5,13,-8))
solve(A,B)
##      [,1]
## [1,]    7
## [2,]   -1
## [3,]    0
A.x = B
x=matrix(c(7,-1,0))


#Finding A Inverse
A=matrix(c(1,2,-1,2,1,1,-3,-3,2),3,3)
solve(A)
##            [,1]      [,2] [,3]
## [1,] -0.8333333 1.1666667  0.5
## [2,]  0.1666667 0.1666667  0.5
## [3,] -0.5000000 0.5000000  0.5
#Non Zero Output
#C=matrix(c(0,1,0))--Output
A1=matrix(c(1,2,1,2,1,1,5,13,-8),3,3)
B=matrix(c(5,13,-8))
solve(A1,B)
##      [,1]
## [1,]    0
## [2,]    0
## [3,]    1
# Solve for x for second question
Q=matrix(c(3,1,4,4,3,3,2,3,2),nrow=3)
R=matrix(c(1,4,5))
solve(Q,R)
##           [,1]
## [1,]  1.461538
## [2,] -2.538462
## [3,]  3.384615
#Determinant of matrix
det(Q)
## [1] 13
Q1=matrix(c(1,4,5,4,3,3,2,3,2),nrow=3)
det(Q1)
## [1] 19
Q2=matrix(c(3,1,4,1,4,5,2,3,2),nrow=3)
det(Q2)
## [1] -33
Q3=matrix(c(3,1,4,4,3,3,1,4,5),nrow=3)
det(Q3)
## [1] 44