1 | initial version |
The problem is not the warnings, but our conversion to Sage :
sage: Ex=(-b*x+2)^(5/2)*x^(1/2)
sage: %time GI=libgiac(Ex).integrate(libgiac(x))
CPU times: user 17.1 s, sys: 412 ms, total: 17.6 s
Wall time: 17.6 s
sage: GI
GI
1/b*(2*b^3*abs(b)/b^2*(2*(((-90*b^11*1/1440/b^14*sqrt(-b*x+2)*sqrt(-b*x+2)+750*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)-2445*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)+4185*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-35/8/b^2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-12*b^2*abs(b)/b^2*(2*((12*b^5*1/144/b^7*sqrt(-b*x+2)*sqrt(-b*x+2)-78*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*x+2)+198*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-5/2/b/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-24*b/b*abs(b)/b^2*(2*(1/8*sqrt(-b*x+2)*sqrt(-b*x+2)-5/8)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)+6*b/4/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-16*abs(b)/b^2*(1/2*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-2*b/2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2)))))
After a bit of exploration ('not shown), it turns out that giacs's ln
is problematic. So we can work around this. Awful version :
sage: SR(str(GI).replace("ln","log")).simplify_full()
1/24*((6*b^3*x^3 - 34*b^2*x^2 + 59*b*x - 15)*sqrt(b^2*x)*sqrt(-b*x + 2) - 30*sqrt(-b)*log(abs(sqrt(-b*x + 2)*sqrt(-b) - sqrt(b^2*x))))/(b*abs(b))
$$ \frac{{\left(6 \, b^{3} x^{3} - 34 \, b^{2} x^{2} + 59 \, b x - 15\right)} \sqrt{b^{2} x} \sqrt{-b x + 2} - 30 \, \sqrt{-b} \log\left({\left| \sqrt{-b x + 2} \sqrt{-b} - \sqrt{b^{2} x} \right|}\right)}{24 \, b {\left| b \right|}} $$
In fact, all the Sage-accessible integrators need a bit nudging to obtain usable results. Meditate the results of the following code (unLaTeXable by this site's tools) :
var("b")
Ex = (-b*x+2)^(5/2)*x^(1/2)
t0 = systime()
with assuming(b<0): MN = Ex.integrate(x).simplify_full()
M0 = Ex.subs(b==0).integrate(x).simplify_full()
with assuming(b>0): MP = Ex.integrate(x).simplify_full()
M = cases([(b<0, MN), (b==0, M0), (b>0, MP)]).function(x)
tM=systime()
S = Ex.integrate(x, algorithm="sympy").function(x)
tS= systime()
G = SR(str(libgiac(Ex).integrate(libgiac(x))).replace("ln","log"))\
.simplify_full().function(x)
tG = systime()
Fl = [u.function(x) for u in Ex.integrate(x, algorithm="fricas")]
tF = systime()
Sqrt = function("Sqrt")
MM = mathematica.Integrate(Ex, x)\
.sage().substitute_function(Sqrt,sqrt).function(x)
tMM = systime()
TR = table(rows=[["Sage", round(tM-t0,3), M],
["Sympy", round(tS-tM, 3), S],
["Giac", round(tG-tS, 3), G],
["Fricas", round(tF-tG, 3), matrix([[Fl[0]],[Fl[1]]])],
["Mathematica", round(tMM-tF, 3), MM]],
header_row=["Integrator","time", "result"])
Comments later (France's curfew ahead..).
2 | No.2 Revision |
The problem is not the warnings, but our conversion to Sage :
sage: Ex=(-b*x+2)^(5/2)*x^(1/2)
sage: %time GI=libgiac(Ex).integrate(libgiac(x))
CPU times: user 17.1 s, sys: 412 ms, total: 17.6 s
Wall time: 17.6 s
sage: GI
GI
1/b*(2*b^3*abs(b)/b^2*(2*(((-90*b^11*1/1440/b^14*sqrt(-b*x+2)*sqrt(-b*x+2)+750*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)-2445*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)+4185*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-35/8/b^2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-12*b^2*abs(b)/b^2*(2*((12*b^5*1/144/b^7*sqrt(-b*x+2)*sqrt(-b*x+2)-78*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*x+2)+198*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-5/2/b/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-24*b/b*abs(b)/b^2*(2*(1/8*sqrt(-b*x+2)*sqrt(-b*x+2)-5/8)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)+6*b/4/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-16*abs(b)/b^2*(1/2*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-2*b/2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2)))))
After a bit of exploration ('not shown), it turns out that giacs's ln
is problematic. So we can work around this. Awful version :
sage: SR(str(GI).replace("ln","log")).simplify_full()
1/24*((6*b^3*x^3 - 34*b^2*x^2 + 59*b*x - 15)*sqrt(b^2*x)*sqrt(-b*x + 2) - 30*sqrt(-b)*log(abs(sqrt(-b*x + 2)*sqrt(-b) - sqrt(b^2*x))))/(b*abs(b))
$$ \frac{{\left(6 \, b^{3} x^{3} - 34 \, b^{2} x^{2} + 59 \, b x - 15\right)} \sqrt{b^{2} x} \sqrt{-b x + 2} - 30 \, \sqrt{-b} \log\left({\left| \sqrt{-b x + 2} \sqrt{-b} - \sqrt{b^{2} x} \right|}\right)}{24 \, b {\left| b \right|}} $$
In fact, all the Sage-accessible integrators need a bit nudging to obtain usable results. Meditate the results of the following code (unLaTeXable by this site's tools) :
var("b")
Ex = (-b*x+2)^(5/2)*x^(1/2)
t0 = systime()
with assuming(b<0): MN = Ex.integrate(x).simplify_full()
M0 = Ex.subs(b==0).integrate(x).simplify_full()
with assuming(b>0): MP = Ex.integrate(x).simplify_full()
M = cases([(b<0, MN), (b==0, M0), (b>0, MP)]).function(x)
tM=systime()
S = Ex.integrate(x, algorithm="sympy").function(x)
tS= systime()
G = SR(str(libgiac(Ex).integrate(libgiac(x))).replace("ln","log"))\
.simplify_full().function(x)
tG = systime()
Fl = [u.function(x) for u in Ex.integrate(x, algorithm="fricas")]
tF = systime()
Sqrt = function("Sqrt")
MM = mathematica.Integrate(Ex, x)\
.sage().substitute_function(Sqrt,sqrt).function(x)
tMM = systime()
TR = table(rows=[["Sage", round(tM-t0,3), M],
["Sympy", round(tS-tM, 3), S],
["Giac", round(tG-tS, 3), G],
["Fricas", round(tF-tG, 3), matrix([[Fl[0]],[Fl[1]]])],
["Mathematica", round(tMM-tF, 3), MM]],
header_row=["Integrator","time", "result"])
Comments later (France's curfew ahead..).
EDIT :
As announced, a few comments :
Fricas' answer is (probably) incomplete : both expressions rederive to Ex
, but their validity limits are not stated. This is to be explored within the original Fricas interface, with a probable followup ticket.
Giac library's answer as well as Sympy's in the case $\frac{\left|bx\right|}{2}>1$ are a figment of their respective authors' imagination: the derivatives of the proposed expression cannot be proved equal to Ex
(but I have not computed their quotients or ratios, just plotted a few numerical cases). Deriving the other expressions with respect to x give expressions which can be proved equal to Ex
.
It is probably not a coincidence if these two incorrect answers are obtained after a much longer time than "correct" ones...
Using cases
expressions proved surprisingly heavy. For example, the subs
and plot
methods don't work at all. The diff
method does surprising things. This has to be enhanced : ticket ahoy ! (But this one is difficult to report correctly...).
A peek at the answer given by Wolframl alpha gives hints on the origin of the different antiderivative forms given bu=y the different CASes.
In conclusion :
CASes are a big help, but you MUST check their answers by any means available. And a great strength of Sage is the availability of a common framework and interface to various CASes.
3 | No.3 Revision |
The problem is not the warnings, but our conversion to Sage :
sage: Ex=(-b*x+2)^(5/2)*x^(1/2)
sage: %time GI=libgiac(Ex).integrate(libgiac(x))
CPU times: user 17.1 s, sys: 412 ms, total: 17.6 s
Wall time: 17.6 s
sage: GI
GI
1/b*(2*b^3*abs(b)/b^2*(2*(((-90*b^11*1/1440/b^14*sqrt(-b*x+2)*sqrt(-b*x+2)+750*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)-2445*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)+4185*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-35/8/b^2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-12*b^2*abs(b)/b^2*(2*((12*b^5*1/144/b^7*sqrt(-b*x+2)*sqrt(-b*x+2)-78*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*x+2)+198*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-5/2/b/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-24*b/b*abs(b)/b^2*(2*(1/8*sqrt(-b*x+2)*sqrt(-b*x+2)-5/8)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)+6*b/4/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-16*abs(b)/b^2*(1/2*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-2*b/2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2)))))
After a bit of exploration ('not shown), it turns out that giacs's ln
is problematic. So we can work around this. Awful version :
sage: SR(str(GI).replace("ln","log")).simplify_full()
1/24*((6*b^3*x^3 - 34*b^2*x^2 + 59*b*x - 15)*sqrt(b^2*x)*sqrt(-b*x + 2) - 30*sqrt(-b)*log(abs(sqrt(-b*x + 2)*sqrt(-b) - sqrt(b^2*x))))/(b*abs(b))
$$ \frac{{\left(6 \, b^{3} x^{3} - 34 \, b^{2} x^{2} + 59 \, b x - 15\right)} \sqrt{b^{2} x} \sqrt{-b x + 2} - 30 \, \sqrt{-b} \log\left({\left| \sqrt{-b x + 2} \sqrt{-b} - \sqrt{b^{2} x} \right|}\right)}{24 \, b {\left| b \right|}} $$
In fact, all the Sage-accessible integrators need a bit nudging to obtain usable results. Meditate the results of the following code (unLaTeXable by this site's tools) :
var("b")
Ex = (-b*x+2)^(5/2)*x^(1/2)
t0 = systime()
with assuming(b<0): MN = Ex.integrate(x).simplify_full()
M0 = Ex.subs(b==0).integrate(x).simplify_full()
with assuming(b>0): MP = Ex.integrate(x).simplify_full()
M = cases([(b<0, MN), (b==0, M0), (b>0, MP)]).function(x)
tM=systime()
S = Ex.integrate(x, algorithm="sympy").function(x)
tS= systime()
G = SR(str(libgiac(Ex).integrate(libgiac(x))).replace("ln","log"))\
.simplify_full().function(x)
tG = systime()
Fl = [u.function(x) for u in Ex.integrate(x, algorithm="fricas")]
tF = systime()
Sqrt = function("Sqrt")
MM = mathematica.Integrate(Ex, x)\
.sage().substitute_function(Sqrt,sqrt).function(x)
tMM = systime()
TR = table(rows=[["Sage", round(tM-t0,3), M],
["Sympy", round(tS-tM, 3), S],
["Giac", round(tG-tS, 3), G],
["Fricas", round(tF-tG, 3), matrix([[Fl[0]],[Fl[1]]])],
["Mathematica", round(tMM-tF, 3), MM]],
header_row=["Integrator","time", "result"])
Comments later (France's curfew ahead..).
EDIT :
As announced, a few comments :
Fricas' answer is (probably) incomplete : both expressions rederive to Ex
, but their validity limits are not stated. This is to be explored within the original Fricas interface, with a probable followup ticket.
Giac library's answer as well as Sympy's in the case $\frac{\left|bx\right|}{2}>1$ are a figment of their respective authors' imagination: the derivatives of the proposed expression cannot be proved equal to Ex
(but I have not computed their quotients or ratios, just plotted a few numerical cases). Deriving the other expressions with respect to x give expressions which can be proved equal to Ex
.
It is probably not a coincidence if these two incorrect answers are obtained after a much longer time than "correct" ones...
Using cases
expressions proved surprisingly heavy. For example, the subs
and plot
methods don't work at all. The diff
method does surprising things. This has to be enhanced : ticket ahoy ! (But this one is difficult to report correctly...).
A peek at the answer given by Wolframl alpha gives hints on the origin of the different antiderivative forms given bu=y the different CASes.
In conclusion :
CASes are a big help, but you MUST check their answers by any means available.available (including numerical ones, which cannot prove you right but can prove you wrong) And a great strength of Sage is the availability of a common framework and interface to various CASes.
4 | No.4 Revision |
The problem is not the warnings, but our conversion to Sage :
sage: Ex=(-b*x+2)^(5/2)*x^(1/2)
sage: %time GI=libgiac(Ex).integrate(libgiac(x))
CPU times: user 17.1 s, sys: 412 ms, total: 17.6 s
Wall time: 17.6 s
sage: GI
GI
1/b*(2*b^3*abs(b)/b^2*(2*(((-90*b^11*1/1440/b^14*sqrt(-b*x+2)*sqrt(-b*x+2)+750*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)-2445*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)+4185*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-35/8/b^2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-12*b^2*abs(b)/b^2*(2*((12*b^5*1/144/b^7*sqrt(-b*x+2)*sqrt(-b*x+2)-78*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*x+2)+198*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-5/2/b/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-24*b/b*abs(b)/b^2*(2*(1/8*sqrt(-b*x+2)*sqrt(-b*x+2)-5/8)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)+6*b/4/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-16*abs(b)/b^2*(1/2*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-2*b/2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2)))))
After a bit of exploration ('not shown), it turns out that giacs's ln
is problematic. So we can work around this. Awful version :
sage: SR(str(GI).replace("ln","log")).simplify_full()
1/24*((6*b^3*x^3 - 34*b^2*x^2 + 59*b*x - 15)*sqrt(b^2*x)*sqrt(-b*x + 2) - 30*sqrt(-b)*log(abs(sqrt(-b*x + 2)*sqrt(-b) - sqrt(b^2*x))))/(b*abs(b))
$$ \frac{{\left(6 \, b^{3} x^{3} - 34 \, b^{2} x^{2} + 59 \, b x - 15\right)} \sqrt{b^{2} x} \sqrt{-b x + 2} - 30 \, \sqrt{-b} \log\left({\left| \sqrt{-b x + 2} \sqrt{-b} - \sqrt{b^{2} x} \right|}\right)}{24 \, b {\left| b \right|}} $$
In fact, all the Sage-accessible integrators need a bit nudging to obtain usable results. Meditate the results of the following code (unLaTeXable by this site's tools) :
var("b")
Ex = (-b*x+2)^(5/2)*x^(1/2)
t0 = systime()
with assuming(b<0): MN = Ex.integrate(x).simplify_full()
M0 = Ex.subs(b==0).integrate(x).simplify_full()
with assuming(b>0): MP = Ex.integrate(x).simplify_full()
M = cases([(b<0, MN), (b==0, M0), (b>0, MP)]).function(x)
tM=systime()
S = Ex.integrate(x, algorithm="sympy").function(x)
tS= systime()
G = SR(str(libgiac(Ex).integrate(libgiac(x))).replace("ln","log"))\
.simplify_full().function(x)
tG = systime()
Fl = [u.function(x) for u in Ex.integrate(x, algorithm="fricas")]
tF = systime()
Sqrt = function("Sqrt")
MM = mathematica.Integrate(Ex, x)\
.sage().substitute_function(Sqrt,sqrt).function(x)
tMM = systime()
TR = table(rows=[["Sage", round(tM-t0,3), M],
["Sympy", round(tS-tM, 3), S],
["Giac", round(tG-tS, 3), G],
["Fricas", round(tF-tG, 3), matrix([[Fl[0]],[Fl[1]]])],
["Mathematica", round(tMM-tF, 3), MM]],
header_row=["Integrator","time", "result"])
Comments later (France's curfew ahead..).
EDIT :
As announced, a few comments :
Fricas' answer is (probably) incomplete : both expressions rederive to Ex
, but their validity limits are not stated. This is to be explored within the original Fricas interface, with a probable followup ticket.
Giac library's answer as well as Sympy's in the case $\frac{\left|bx\right|}{2}>1$ are a figment of their respective authors' imagination: the derivatives of the proposed expression cannot be proved equal to Ex
(but I have not computed their quotients or ratios, just plotted a few numerical cases). Deriving the other expressions with respect to x give expressions which can be proved equal to Ex
.
It is probably not a coincidence if these two incorrect answers are obtained after a much longer time than "correct" ones...
Using cases
expressions proved surprisingly heavy. For example, the subs
and plot
methods don't work at all. The diff
method does surprising things. This has to be enhanced : ticket ahoy ! (But this one is difficult to report correctly...).
A peek at the answer given by Wolframl alpha gives hints on the origin of the different antiderivative forms given bu=y the different CASes.
<rant>
Mathjax is no sufficient substitute to $\LaTeX$...</rant>
.
In conclusion :
CASes are a big help, but you MUST check their answers by any means available (including numerical ones, which cannot prove you right but can prove you wrong) And a great strength of Sage is the availability of a common framework and interface to various CASes.
5 | No.5 Revision |
The problem is not the warnings, but our conversion to Sage :
sage: Ex=(-b*x+2)^(5/2)*x^(1/2)
sage: %time GI=libgiac(Ex).integrate(libgiac(x))
CPU times: user 17.1 s, sys: 412 ms, total: 17.6 s
Wall time: 17.6 s
sage: GI
GI
1/b*(2*b^3*abs(b)/b^2*(2*(((-90*b^11*1/1440/b^14*sqrt(-b*x+2)*sqrt(-b*x+2)+750*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)-2445*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*x+2)+4185*b^11*1/1440/b^14)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-35/8/b^2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-12*b^2*abs(b)/b^2*(2*((12*b^5*1/144/b^7*sqrt(-b*x+2)*sqrt(-b*x+2)-78*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*x+2)+198*b^5*1/144/b^7)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-5/2/b/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-24*b/b*abs(b)/b^2*(2*(1/8*sqrt(-b*x+2)*sqrt(-b*x+2)-5/8)*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)+6*b/4/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2))))-16*abs(b)/b^2*(1/2*sqrt(-b*x+2)*sqrt(-b*(-b*x+2)+2*b)-2*b/2/sqrt(-b)*ln(abs(sqrt(-b*(-b*x+2)+2*b)-sqrt(-b)*sqrt(-b*x+2)))))
After a bit of exploration ('not shown), it turns out that giacs's ln
is problematic. So we can work around this. Awful version :
sage: SR(str(GI).replace("ln","log")).simplify_full()
1/24*((6*b^3*x^3 - 34*b^2*x^2 + 59*b*x - 15)*sqrt(b^2*x)*sqrt(-b*x + 2) - 30*sqrt(-b)*log(abs(sqrt(-b*x + 2)*sqrt(-b) - sqrt(b^2*x))))/(b*abs(b))
$$ \frac{{\left(6 \, b^{3} x^{3} - 34 \, b^{2} x^{2} + 59 \, b x - 15\right)} \sqrt{b^{2} x} \sqrt{-b x + 2} - 30 \, \sqrt{-b} \log\left({\left| \sqrt{-b x + 2} \sqrt{-b} - \sqrt{b^{2} x} \right|}\right)}{24 \, b {\left| b \right|}} $$
In fact, all the Sage-accessible integrators need a bit nudging to obtain usable results. Meditate the results of the following code (unLaTeXable by this site's tools) :
var("b")
Ex = (-b*x+2)^(5/2)*x^(1/2)
from time import time as systime
t0 = systime()
with assuming(b<0): MN = Ex.integrate(x).simplify_full()
M0 = Ex.subs(b==0).integrate(x).simplify_full()
with assuming(b>0): MP = Ex.integrate(x).simplify_full()
M = cases([(b<0, MN), (b==0, M0), (b>0, MP)]).function(x)
tM=systime()
S = Ex.integrate(x, algorithm="sympy").function(x)
tS= systime()
G = SR(str(libgiac(Ex).integrate(libgiac(x))).replace("ln","log"))\
.simplify_full().function(x)
tG = systime()
Fl = [u.function(x) for u in Ex.integrate(x, algorithm="fricas")]
tF = systime()
Sqrt = function("Sqrt")
MM = mathematica.Integrate(Ex, x)\
.sage().substitute_function(Sqrt,sqrt).function(x)
tMM = systime()
TR = table(rows=[["Sage", round(tM-t0,3), M],
["Sympy", round(tS-tM, 3), S],
["Giac", round(tG-tS, 3), G],
["Fricas", round(tF-tG, 3), matrix([[Fl[0]],[Fl[1]]])],
["Mathematica", round(tMM-tF, 3), MM]],
header_row=["Integrator","time", "result"])
Comments later (France's curfew ahead..).
EDIT :
As announced, a few comments :
Fricas' answer is (probably) incomplete : both expressions rederive to Ex
, but their validity limits are not stated. This is to be explored within the original Fricas interface, with a probable followup ticket.
Giac library's answer as well as Sympy's in the case $\frac{\left|bx\right|}{2}>1$ are a figment of their respective authors' imagination: the derivatives of the proposed expression cannot be proved equal to Ex
(but I have not computed their quotients or ratios, just plotted a few numerical cases). Deriving the other expressions with respect to x give expressions which can be proved equal to Ex
.
It is probably not a coincidence if these two incorrect answers are obtained after a much longer time than "correct" ones...
Using cases
expressions proved surprisingly heavy. For example, the subs
and plot
methods don't work at all. The diff
method does surprising things. This has to be enhanced : ticket ahoy ! (But this one is difficult to report correctly...).
A peek at the answer given by Wolframl alpha gives hints on the origin of the different antiderivative forms given bu=y the different CASes.
<rant>
Mathjax is no sufficient substitute to $\LaTeX$...</rant>
.
In conclusion :
CASes are a big help, but you MUST check their answers by any means available (including numerical ones, which cannot prove you right but can prove you wrong) And a great strength of Sage is the availability of a common framework and interface to various CASes.