Lab 6: Overview

Week 6, February 15

MAT 229, Spring 2021

Techniques of integration

Integration by parts ∫u d v=u v-∫v d u

Trigonometric integrals: ∫(sin^m)(x)(cos^n)(x)d x, ∫(tan^m)(x)(sec^n)(x)d x, ∫(cot^m)(x)(csc^n)(x)d x

Trigonometric substitutions

roots of (a^2)-(x^2) ⟶ x=a sin(θ), d x=a cos(θ)d θ

roots of (a^2)+(x^2) ⟶ x=a tan(θ), d x=a (sec^2)(θ)d θ

roots of (x^2)-(a^2) ⟶ x=a sec(θ), d x=a sec(θ)tan(θ)d θ

Example

Evaluate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x

Integrate[1/Sqrt[16+x^2],{x,0,3}]
N[%]
Log[2.0]
true=Log[2]

Numerical integration

Left endpoint rule -- (Subscript[L, n])

To estimate (∫_a^b)f(x)d x using n rectangles

Width: Δ x=((b-a)/n)

We subdivide the interval [a,b] into (n+1) x-values:

(Subscript[x, 0])=a+0Δ x=a,

(Subscript[x, 1])=a+1Δ x,

(Subscript[x, 2])=a+2Δ x, ,…,

(Subscript[x, k])=a+k Δ x, …,

(Subscript[x, n])=a+n Δ x=a+n((b-a)/n)=a+(b-a)=b

(∫_a^b)f(x)d x≈Δ x ((Underoverscript[Σ, (k=1), n])f(a+(k-1)Δ x))

Example

Estimate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x using the left endpoint rule with n=50.

f[x_]:=1/Sqrt[16+(x^2)]
Plot[f[x],{x,0,3},PlotRange->{0,0.3}]

Clear[a,b,n,dx]
a=0.0
b=3.0
n=50
dx=(b-a)/n

lrr50=dx*Sum[f[a+(k-1)dx],{k,1,50}]
true=Log[2.0]
lrr50-true

Right endpoint rule -- (Subscript[R, n])

To estimate (∫_a^b)f(x)d x using n rectangles

Same Width: Δ x=((b-a)/n)

Same x-values: (Subscript[x, 0])=a, (Subscript[x, 1])=a+Δ x, (Subscript[x, 2])=a+2Δ x, (Subscript[x, 3])=a+3Δ x, …, (Subscript[x, k])=a+k Δ x, …, (Subscript[x, n])=a +n Δ x=b

(∫_a^b)f(x)d x≈Δ x ((Underoverscript[Σ, (k=1), n])f(a+k Δ x))

Example

Estimate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x using the right endpoint rule with n=50.

rrr50=Sum[dx*f[a+k dx],{k,1,50}]
true
rrr50-true

Midpoint rule

To estimate (∫_a^b)f(x)d x using n rectangles

Same Width: Δ x=((b-a)/n)

Different x-values: (Subscript[x, 1])=a+(1/2)Δ x, (Subscript[x, 2])=a+(3/2)Δ x, (Subscript[x, 3])=a+(5/2)Δ x, …, (Subscript[x, k])=a+((2k-1)/2)Δ x=a+(k-(1/2))Δ x, …, (Subscript[x, n])=a +(n-(1/2))Δ x=a+(b-a)-(1/2)Δ x=b-(1/2)Δ x

(∫_a^b)f(x)d x≈Δ x ((Underoverscript[Σ, (k=1), n])f(a+(k-(1/2)) Δ x))

Example

Estimate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x using the midpoint rule with n=50.

mid50=dx*Sum[f[a+(k-1/2) dx],{k,1,50}]
true
mid50-true

Trapezoid rule

(∫_a^b)f(x)d x≈(1/2) ( (Subscript[L, n])+ (Subscript[R, n]))

Example

Estimate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x using the trapezoid rule with n=50.

trap50=1/2(lrr50+rrr50)
true
trap50-true

Error estimate

For the trapezoid rule the absolute error is less than or equal to
	(((K(b-a))^3)/(12(n^2)))

Plot[Abs[f''[x]],{x,a,b}]

K2=Abs[f''[a]]
K2=.016

trapErr=K2(b-a)^3/(12*n^2)

midErr=K2(b-a)^3/(24*n^2)

Simpson’s rule

To estimate (∫_a^b)f(x)d x using 2n rectangles (always even)

Both sets of  x-values; those for Trapezoidal, and those for Midpoint

Double the n for the corresponding Trapezoidal and Midpoint Rules.

(∫_a^b)f(x)d x≈(Subscript[S, 2n])=(1/3) (2(Subscript[M, n])+(Subscript[T, n]))

Example

Estimate the definite integral (∫_0^3)(1/(Sqrt[16+(x^2)]))d x using Simpson’s rule with n=100.

S100=(2*mid50+trap50)/3
true
S100-true

Error estimate

For Simpson’s rule the absolute error is less than or equal to
	(((K(b-a))^5)/(180(n^4)))

Plot[Abs[f''''[x]],{x,0,3}]

K4=Abs[f''''[0.]]
K4=0.009

K4(b-a)^5/(180*(2n)^4)