Assuming integrate(w(x) * atan2(f(x), g(x)),x) = a(x) * atan2(f(x),g(x)) + b(x) yields
linear DEs for a and b; these equations are
['diff(a(x),x,1)=w(x),'diff(b(x),x,1)=(a(x)*(f(x)*('diff(g(x),x,1))-g(x)*('diff(f(x),x,1))))/(g(x)^2+f(x)^2)
Each DE is easily solved by quadrature. Examples:
(%i2) integrate(atan2(a,b),a);
(%o2) a*atan2(a,b)-b*log(b^2+a^2)/2
(%i3) integrate(atan2(a,b),b);
(%o3) a*log(b^2+a^2)/2+atan2(a,b)*b
(%i4) diff(%,b);
(%o4) atan2(a,b)
(%i5) integrate(atan2(x,x^2),x);
(%o5) log(x^2+1)/2+x*atan2(x,x^2)
(%i6) diff(%,x);
(%o6) atan2(x,x^2)-x^3/(x^4+x^2)+x/(x^2+1)
(%i7) ratsimp(%);
(%o7) atan2(x,x^2)
(%i8) integrate(sqrt(x) * atan2(x,x^2),x);
(%o8) 4*(-log(x+sqrt(2)*sqrt(x)+1)/2^(5/2)+log(x-sqrt(2)*sqrt(x)+1)/2^(5/2)
+sqrt(x)
-atan((2*sqrt(x)+sqrt(2))/sqrt(2))
/2^(3/2)
-atan((2*sqrt(x)-sqrt(2))/sqrt(2))
/2^(3/2)) /3 +2*x^(3/2)*atan2(x,x^2)/3
(%i9) diff(%,x),ratsimp;
(%o9) sqrt(x)*atan2(x,x^2)
(%i10) integrate(atan2(1,x),x,-1,1);
(%o10) (2*log(2)+%pi)/4-log(2)/2+3*%pi/4
(%i11) expand(%);
(%o11) %pi
(%i12) integrate(x^2*atan2(1,x),x,-1,1);
(%o12) %pi/3
The change to sin.lisp is modest--mostly insert a new 17 line function for integration of atan2 expressions.
--Barton
Derivation of the DEs for a and b:
(%i6) integrate(w(x) * atan2(f(x),g(x)),x) = a(x) * atan2(f(x),g(x)) + b(x)$
(%i7) diff(%,x)$
(%i8) bothcoeff(%,atan2(f(x),g(x)))$
(%i9) solve(%,[diff(a(x),x),diff(b(x),x)])$
(%i10) facsum(%,a(x));
(%o10) [['diff(a(x),x,1)=w(x),'diff(b(x),x,1)=(a(x)*(f(x)*('diff(g(x),x,1))-g(x)*('diff(f(x),x,1))))/(g(x)^2+f(x)^2)]]
________________________________