I am working on interactive notebooks with several symbolic calculations, among which there are two indefinite integrals involving square roots. These are integrals (29) and (30) of this table of integrals --> http://integral-table.com.
When I try to evaluate these indefinite integrals with wxMaxima and Sympy, I get wrong results:
wxMaxima:
(29) Similar to the correct one, but the argument of the log function is wrong.
(%i127) integrate(sqrt(x^2-a^2),x);
(%o127) (x*sqrt(x^2-a^2))/2-(a^2*log(2*sqrt(x^2-a^2)+2*x))/2
(30) Similar to the correct one, but with arcsin instead of arctan and wrong argument.
(%i128) integrate(sqrt(a^2-x^2), x);
(%o128) (a^2*asin(x/abs(a)))/2+(x*sqrt(a^2-x^2))/2
Sympy:
(29) Completely different and messy result.
from sympy import *
x, a = Symbol('x', real=True), Symbol('a', real=True)
integrate(sqrt(x**2 - a**2), x)
Result of integral (29) with Sympy
(30) Again, completely different and messy result.
integrate(sqrt(a**2-x**2),x)
Result of integral (30) with Sympy
Instead, with Wolfram Alpha I get the correct primitive functions:
(29) https://www.wolframalpha.com/input/?i=Integrate%5BSqrt%5B+x%5E2-a%5E2%5D%2C+x%5D
(30) https://www.wolframalpha.com/input/?i=Integrate%5BSqrt%5Ba%5E2+-+x%5E2%5D%2C+x%5D
Does anyone know how to circumvent this problem, at least with wxMaxima? Maybe there is some trick, or, as I think, these are bugs to be reported to the developers.
Thank you!
p.s.: I need to work on a free notebook, so using Wolfram Alpha or Mathematica is not a solution.
EDITED: With regard to integral (30), by googling around I just discovered this relation between arcsin and arctan functions:
asin(x/a) = atan(x/sqrt(a^2-x^2))
This makes the result I obtained with Maxima equal to that indicated in the Table of Integrals and given by Wolfram Alpha. However, it seems that wxMaxima doesn't know this relation, since:
(%i165) ratsimp(atan(x/sqrt(a^2-x^2))- asin(x/a));
(%o165) atan(x/sqrt(a^2-x^2))-asin(x/a)
or by setting a=2, for example:
(%i167) ratsimp(atan(x/sqrt(a^2-x^2))- asin(x/a)), a=2;
(%o167) atan(x/sqrt(4-x^2))-asin(x/2)
I tried to employ several simplification methods, but I never obtained zero, hence equivalence between asin(x/a) and atan(x/sqrt(a^2-x^2)).