Advice: Errors in symbolic integration

As most calculus students know, integration can be a difficult process. Even in Maple, the difficulties have not all been overcome, and symbolic integration should not be considered as completely reliable in all cases. In general it is prudent to check the correctness of integrals, either by comparing definite integrals to their floating-point approximations or by comparing the derivative of an indefinite integral to the integrand.

One common source of trouble is multivalued functions. In particular, a definite integral int(f(x), x = a .. b) may give a wrong answer because the antiderivative is a multivalued function F with a branch cut crossing the path of integration. Maple may not recognize the branch cut, and return F(b)-F(a) as the value of the definite integral. Note that this can happen even when the integrand f is single-valued.

In other cases, when f is multivalued Maple may find an antiderivative for the wrong choice of branch of f .

Examples:

The following example is in Maple 6 as of January 2000. It may be corrected in later releases.

We begin with the function f = t/(2-cos(t^2)^2) and its antiderivative . Note that f is continuous on the whole real line.

> f:= t/(2-cos(t^2)^2);

f := t/(2-cos(t^2)^2)

> F:= simplify(int(f,t));

F := 1/4*sqrt(2)*(arctan(tan(1/2*t^2)/(1+sqrt(2)))+...

This is correct in the sense that the difference between f and the derivative of F simplifies (with a little help) to 0.

> simplify(diff(F,t)-f);

t*(4*cos(1/2*t^2)^4-4*cos(1/2*t^2)^2-cos(t^2)^2+1)/...
t*(4*cos(1/2*t^2)^4-4*cos(1/2*t^2)^2-cos(t^2)^2+1)/...
t*(4*cos(1/2*t^2)^4-4*cos(1/2*t^2)^2-cos(t^2)^2+1)/...

> combine(%,trig);

0

Here is a definite integral with this integrand.

> J1:=int(f, t= 0 .. 2);

J1 := 1/4*sqrt(2)*arctan((1+sqrt(2))*tan(2))+1/4*sq...

> evalf(J1);

-.7492016532

This result is equivalent to that obtained by evaluating the antiderivative at the endpoints of the interval.

> simplify(eval(F,t=2)-eval(F,t=0) - J1);

0

However, the answer is wrong (rather obviously, because the integrand is positive on this interval). Here is the correct value, obtained by numerical integration.

> evalf(Int(f, t=0 .. 2));

1.472239815

> err:= % - evalf(J1);

err := 2.221441468

The cause of the error is a discontinuity of the antiderivative at t = sqrt(Pi) . It has a jump of size equal to the error.

> evalf(limit(F,t=sqrt(Pi),left)-limit(F,t=sqrt(Pi),right));

2.221441469

The next example features a problem with branches of a fractional power.

> f:=((2-3*x)^(-2)*x^(-8))^(1/5);

f := (1/((2-3*x)^2*x^8))^(1/5)

> F:= int(f,x);

F := 5/6*(-2+3*x)/(((-2+3*x)^2*x^3)^(1/5))

> simplify(diff(F,x));

1/(((-2+3*x)^2*x^3)^(1/5)*x)

This is the same as f for positive x , but not for negative x (with the principal branch of the fifth root, which Maple uses).

> evalf(subs(x=-1,diff(F,x)));

-.4249811260+.3087668616*I

> evalf(subs(x=-1,f));

.5253055608

See also: int , Integrals involving fractional powers , Numerical integration

Maple Advisor Database R. Israel, 1998