chapter 7.4 Question #3

find the arc length of the function \(f(x) = x\) on the interval \([0, 1]\),

formula for arc length:

\[ L = \int_{a}^{b} \sqrt{1 + (f'(x))^2} \, dx \]

\[ f(x) = x \] \[ f'(x) = 1 \]

\[ L = \int_{0}^{1} \sqrt{1 + (1)^2} \, dx \] \[ L = \int_{0}^{1} \sqrt{2} \, dx \] \[ L = \sqrt{2} \int_{0}^{1} dx \] \[ L = \sqrt{2} \left[ x \right]_{0}^{1} \] \[ L = \sqrt{2} (1 - 0) \] \[ L = \sqrt{2} \]

the arc length of the function \(f(x) = x\) on the interval \([0, 1]\) is \(\sqrt{2}\).

library(pracma)


f <- function(x) {x}

# the derivative f(x)
f_prime <- function(x) {1}

# interval
a <- 0
b <- 1

# formular for arc length
my_func <- function(x) {sqrt(1 + f_prime(x)^2)}

# finding the arc length using integration
arc_length <- integrate(Vectorize(my_func), lower = a,upper = 1)$value

print(arc_length)
## [1] 1.414214