This is worth 5 points extra credit if done properly and turned in by May 18.
Get this as an ipynb file for IJulia.
Definite integration can be done different ways:
In Julia
, the SymPy
package can find antiderivatives and evaluate, but that isn't needed here.
quadgk
function can provide an answer using an algorithm more sophisticated than a Riemann sum. This function gives two answers: the answer and an estimate on the maximum possible error between the true answer and the numerical estimate. Suppose $f(x) \geq 0$. Then different definite integrals have different interpretations. The Riemann sum approach uses the fact that
The definite integral $\int_a^b f(x) dx$ is the area under $f(x)$ over the interval $[a,b]$.
Some integrals give different values. For example
The definite integral $\int_a^b \sqrt{1 + f'(x)^2} dx$ give the arc length of the graph of $f(x)$ between $a$ and $b$.
You can use the MTH229
package.
using MTH229
quadgk
function (quadgk(f, a, b)
or quadgk(f,a,b)[1]
to get just the answer) to show that the arc length of the function $f(x) = 2 + 3x$ over $[0,4]$ is the same as given by the distance formula between the points $(0, f(0))$ and $(4, f(4))$.cosh
implements the hyperbolic cosine. Make a plot of the graph over the interval $[-2, 3]$. Estimate the area under the graph. (Is it about 6, 10, 14, 20, ...?)quadgk
to numerically find the area under the cosh
function over $[-2, 3]$.quadgk
to numerically find the arc length of the graph of the cosh
function over $[-2, 3]$.