A substitution

Every student of calculus will hear the following advice from his teacher: "If you have problems calculating an integral, try a substitution." The technique of substitution is described nicely in the context of Maple in the book by Wilhelm Werner, already cited (ref. [3]). There you find the procedure SubstRegel explained.

f:=t->(1-t)/((t+1)*t^(1/2)); g:=t->t^(1/2);

Math

Math

Math

Math

Math

Math

Math

Int((1-x)/((x+1)*sqrt(x)),x) = Int(-2*(-1+t^2)/(t^2+1),t);

Math

G := proc(x) (1-x^2)/(1+x^2) end:
G(x);

Math

So Mathcomputes Math

and Mathcomputes Math.

But Mathsimplifies to Math

plot([G(x),1+G(x)],x=-3..3);

[Plot]

So finally we have a smooth integrand to which we can apply the Romberg procedure.

r := Romberg(x -> 2/(x^2+1),-1..1, 5, 20, true):
evalf(r,9),evalf(Pi,9),evalf(Pi-r,20);

Math

i  T[i]
0 +2.00000000
1 +3.00000000 +3.33333333
2 +3.10000000 +3.13333333 +3.12000000
3 +3.13117647 +3.14156863 +3.14211765 +3.14246872
4 +3.13898849 +3.14159250 +3.14159409 +3.14158578 +3.14158232
5 +3.14094161 +3.14159265 +3.14159266 +3.14159264 +3.14159267 +3.14159268

Math

Math

Math

This result looks far better than our first one. We will refine it a little bit in the next section.