Last time | Next time |
With this choice, you're one more integration by parts from the answer.
The trig substitution is a lot more work! But it works....
No one commented on the fact that the left and right rectangle rules and trapezoidal rule all gave the same answer! Is this mysterious? NO!
The function $f(x)$ was equal at the two endpoints: $f(a)=f(b)$. In this case, the LRR and RRR give the same values, so their average is the same! No mystery....
SetOptions[$FrontEndSession, NotebookAutoSave -> True] NotebookSave[]
All these crazy integration schemes boil down to the following commands in Mathematica: Let's do n=10 intervals (for all but Simpson's, which will be 20!)
f[x_]:=Cos[Sqrt[x^3+1]] a=0 b=4 n=10 dx=(b-a)/n lrr=dx*Sum[f[a+(k-1.0)dx],{k,1,n}] rrr=dx*Sum[f[a+(k-0.0)dx],{k,1,n}] mid=dx*Sum[f[a+(k-0.5)dx],{k,1,n}] trap=(lrr+rrr)/2 simp=(2*mid+trap)/3
Simpson's uses twice the "$n$", because it uses all $n$ of midpoints $x$-values, and all $n+1$ of trapezoidal's values; so it uses $2n+1$ points, for $2n$ subintervals.