Question 1

Find the length of the function \(f(x) = x^2 + 2\) on the interval \([0,3]\).

# install.packages("pracma")
library(pracma)
f <- function(x) {
  c(x^2 + 2,x) # c(your_function,your_variable) --> parametrized function
}
arc_length <- arclength(f,a = 0,b = 3)$length
cat("The arc length of the function f(x) = x^2 + 2 on the interval [0,3] is:",arc_length,"\n")
## The arc length of the function f(x) = x^2 + 2 on the interval [0,3] is: 9.747089

Question 2

Write 8,719,723 in words.

# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(8719723)
## [1] "eight million seven hundred nineteen thousand seven hundred twenty-three"

Question 3

Find a solution to the equation \(-10x^3 + 4x - 5 = 0\) correct to 2 decimal places.

# install.packages("rootSolve")
library(rootSolve)
## 
## Attaching package: 'rootSolve'
## The following objects are masked from 'package:pracma':
## 
##     gradient, hessian
g <- function(x) {
  -10 * x^3 + 4 * x - 5
}
roots <- uniroot.all(g,c(-10,10))
for (x in seq_along(roots)) {
  cat("Root",x,":",round(roots[x],2),"\n")
}
## Root 1 : -0.96

Question 4

What is \(\frac{d}{dx} (5x^4 - 7x^2)\)?

# install.packages("Deriv")
library(Deriv)
h <- function(x) {
  5 * x^4 - 7 * x^2
}
h_prime <- Deriv(h)
h_prime
## function (x) 
## {
##     .e1 <- x^2
##     x * (10 * .e1 + 2 * (5 * .e1 - 7))
## }