## 2.5-2: ## ## Plot the fourth derivative of f(x) ## xs = seq(0, pi/2, length.out=100) f_prime_4 = -8 * xs^3 * cos(xs^2) - 8 * xs * sin(xs^2) - 4 * xs * sin(xs^2) print(min(f_prime_4)) plot(xs, f_prime_4, type='l', xlab='x', ylab='f^4(x)', ylim=c(-16.5, max(f_prime_4))) abline(h=-16.5, col='red', lty=1) grid() derivative_bound = 16.5 print((derivative_bound/24)*4*0.1^4) ## 2.5-4: ## xs = c(1, 4/3, 5/3, 2) xbar = 3/2 P = prod(xs - xbar) C = P/factorial(4) print(sprintf('C= %f; error_lower_bound= %f; error_upper_bound= %f', C, C/2^4, C))