## #1957 integrate(rational func) -> choses incorrect branch in atan?

closed
nobody
5
2010-05-13
2010-04-19
Anonymous
No

integrate((x^4+x^2+4)/(x^6-7*x^4+14*x^2+1),x,-2,2);
gives $0.$

From reading "Improving Exact Integrals From Symbolic Algebra Systems" by Fateman and Kahan, page 5,
this should be $2\pi.$

## Discussion

• Raymond Toy - 2010-04-19

Maxima converts this integral to an integral from 0 to inf. This new integral is evaluted using resides, and maxima fails to find the roots of the denominator:

9*x^6-42*x^5+1031*x^4-1932*x^3+1031*x^2-42*x+9

Maxima erroneously returns 0 in this case.

• Aleksas Domarkas - 2010-04-19

For integrating we define block "int_rac(f,x)":

(%i1) int_rac(f,x):=block('integrate(f,x),map(gfactor,%%),
ev(%%,nouns),rectform(%%),logcontract(%%))$1 example (%i2) integrate((x^4+x^2+4)/(x^6-7*x^4+14*x^2+1),x); (%o2) integrate((x^4+x^2+4)/(x^6-7*x^4+14*x^2+1),x) (%i3) f:first(%); (%o3) (x^4+x^2+4)/(x^6-7*x^4+14*x^2+1) We find antiderivative F : (%i4) F:int_rac(f,x); (%o4) -atan2(x^2-1,x^3-4*x) Test: (%i5) diff(F,x),ratsimp; (%o5) (x^4+x^2+4)/(x^6-7*x^4+14*x^2+1) (%i6) limit(F,x,1,minus); (%o6) %pi (%i7) limit(F,x,1,plus); (%o7) -%pi Then F is discontinous at x=1. (%i8) wxplot2d([f,F], [x,-5,5],[y,-5,5])$
(%t8) << Graphics >>
Function f is even. Then
(%i13) 'integrate(f,x,-2,2)=2*(ev(F,x=0)-ev(F,x=-2));
(%o13) integrate((x^4+x^2+4)/(x^6-7*x^4+14*x^2+1),x,-2,2)=2*%pi

2 example
(%i10) S:integrate(1/(x^4+6*x^2+1),x);
(%o10) integrate(1/(x^4+6*x^2+1),x)
(%i11) sol:int_rac(1/(x^4+6*x^2+1),x);
(%o11) (2^(5/2)*atan((2*x)/(x^2+1))+4*atan(x/(sqrt(2)+1))+4*atan(x/(sqrt(2)-1)))/2^(9/2)
Test:
(%i12) diff(%,x),ratsimp;
(%o12) 1/(x^4+6*x^2+1)

• Raymond Toy - 2010-04-29
• status: open --> pending

• Raymond Toy - 2010-04-29

The bug in keyhole integration has been fixed. (defint.lisp, rev 1.76) This now returns a noun form.

Better than returning 0, but not as good as returning 2*%pi.

Setting to pending/fixed.

• SourceForge Robot - 2010-05-13
• status: pending --> closed

• SourceForge Robot - 2010-05-13

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by