Section 7.2 Excersize - 6 - find the arc length of the func on on the given interval. \(f(x) = \dfrac{1}{12}{x}^3 + \dfrac{1}{x}\) on [1,4]
Using R pracma package
library(pracma)
## Warning: package 'pracma' was built under R version 3.4.3
let us define our fuction first and plot the function
func <- function(x) 1/12 * x^(3) + 1/ x
x <- seq(1,4,1)
plot(x,func(x), type="l",
xlab="x", ylab="f(x)", main="f(x) on [1,4]")
Arclength() - Calculates the arc length of a parametrized curve in R^n. It applies Richardson’s extrapolation by refining polygon approximations to the curve.
The parametrization of the curve must be vectorized: if t–>F(t) is the parametrization, F(c(t1,t1,…)) must return c(F(t1),F(t2),…).
F <- function(x) c(x, func(x)) # parametrization of function x
arclength(F, a=1, b=4)
## $length
## [1] 6
##
## $niter
## [1] 6
##
## $rel.err
## [1] 4.347424e-06