DATA 605 Week 13 Discussion

Instructions

Exercise 5.4 Problem 5(APEX Calculus Version 4 Page 246)

Using R, Evaluate the definite integral:

\[∫_1^3 (3x^2 - 2x + 1) \ dx\]

To evaluate the definite integral, first find the antiderivative of the integrand:

\[∫_1^3 (3x^2 - 2x + 1) \ dx = x^2 - x^2 + x + C \]

where C is the constant of integration.

Then, evaluate the antiderivative at the limits of integration:

\[∫_1^3 (3x^2 - 2x + 1) \ dx = [x^3 - x^2 + x]_1^3\]

Substituting the limits of integration: \[= [3^3 - 3^2 + 3] - [1^3 - 1^2 + 1]\]

= 27 - 9 + 3 - 1 + 1 - 1 = 20

Therefore, the definite integral of \[∫_1^3 (3x^2 - 2x + 1) \ dx = 20\]

f <- function(x) {3*x^2 - 2*x + 1}

result <- integrate(f, 1, 3)

result
## 20 with absolute error < 2.2e-13