Ask Your Question
0

Maxima needs a change of variable to succeed in an integral

asked 2020-11-22 10:56:58 +0100

ortollj gravatar image

updated 2020-11-22 10:58:11 +0100

Hi

maxima is not able to integrate this below:

#solExt_0(y)=(((R^2-y^2)*asin(x/(sqrt(R-y)*sqrt(y+R)))+x*sqrt((-y^2)-x^2+R^2))/2 ).subs(x==-sqrt(2*R*y - 2*y^2))
#solExt_1(y)=(((R^2-y^2)*asin(x/(sqrt(R-y)*sqrt(y+R)))+x*sqrt((-y^2)-x^2+R^2))/2 ).subs(x==sqrt(2*R*y - 2*y^2))
#solExt=solExt_1-solExt_0
#show('must give : ',solExt )
var('x,y,R,T',domain='real')
Rnum=1
numL=[R==Rnum]
assume(T>0)
assume(T<=R)
#assume((y-R)*(y+R)<=0)
Iz=sqrt(R^2-y^2 - x^2)

xLow=-sqrt(2*R*y - 2*y^2)
xUp=sqrt(2*R*y - 2*y^2)
show(LatexExpr(r"\int_{"+"}^{"+"} "+latex(Iz))+"dx")
IxT=integrate(Iz(x),x,xLow,xUp)

but succeed with a variable change :

var('x,y,R,T',domain='real')
Rnum=1
numL=[R==Rnum]
assume(T>0)

assume(T<=R)
Iz(x)=sqrt(T - x^2)
xLow=-sqrt(2*R*y - 2*y^2)
xUp=sqrt(2*R*y - 2*y^2)
IxT=integrate(Iz(x),x)


Ix=(IxT.subs(T==R^2-y^2))
show(LatexExpr(r"\int_{"+latex(xLow)+"}^{"+latex(xUp)+"} "+latex(Iz.subs(T==R^2-y^2))+" = "+latex(Ix)))

but may be I need to add some assumes command for the 1st code?

edit retag flag offensive close merge delete

Comments

And your question is ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-11-22 11:44:37 +0100 )edit

do I need to add some assumes command for the 1st code?

ortollj gravatar imageortollj ( 2020-11-22 12:19:01 +0100 )edit

I forgot to precise OS W10 Sagemath 9.1 notebook

ortollj gravatar imageortollj ( 2020-11-22 14:04:48 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-11-22 12:40:27 +0100

Emmanuel Charpentier gravatar image

Your first code snippet, whatever it means, WorksForMe(TM) in 9.3.beta1 :

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:#solExt_0(y)=(((R^2-y^2)*asin(x/(sqrt(R-y)*sqrt(y+R)))+x*sqrt((-y^2)-x^2+R^2))/2 ).subs(x==-sqrt(2*R*y - 2*y^2))
:#solExt_1(y)=(((R^2-y^2)*asin(x/(sqrt(R-y)*sqrt(y+R)))+x*sqrt((-y^2)-x^2+R^2))/2 ).subs(x==sqrt(2*R*y - 2*y^2))
:#solExt=solExt_1-solExt_0
:#show('must give : ',solExt )
:var('x,y,R,T',domain='real')
:Rnum=1
:numL=[R==Rnum]
:assume(T>0)
:assume(T<=R)
:#assume((y-R)*(y+R)<=0)
:Iz=sqrt(R^2-y^2 - x^2)
:
:xLow=-sqrt(2*R*y - 2*y^2)
:xUp=sqrt(2*R*y - 2*y^2)
:show(LatexExpr(r"\int_{"+"}^{"+"} "+latex(Iz))+"dx")
:IxT=integrate(Iz(x),x,xLow,xUp)
:--
(x, y, R, T)
\newcommand{\Bold}[1]{\mathbf{#1}}\int_{}^{} \sqrt{R^{2} - x^{2} - y^{2}} dx
sage: IxT
2*sqrt(2*R*y - 2*y^2)*sqrt(-y^2)

Suggestion : try algorithm="giac" or algorithm="fricas" to see other possible primitives...

I'm afraid that your second code snippet does something different:

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:var('x,y,R,T',domain='real')
:Rnum=1
:numL=[R==Rnum]
:assume(T>0)
:
:assume(T<=R)
:Iz(x)=sqrt(T - x^2)
:xLow=-sqrt(2*R*y - 2*y^2)
:xUp=sqrt(2*R*y - 2*y^2)
:IxT=integrate(Iz(x),x)
:
:
:Ix=(IxT.subs(T==R^2-y^2))
:show(LatexExpr(r"\int_{"+latex(xLow)+"}^{"+latex(xUp)+"} "+latex(Iz.subs(T==R^2-y^2))+" = "+latex(Ix)))
:--
(x, y, R, T)
\newcommand{\Bold}[1]{\mathbf{#1}}\int_{ -\sqrt{2 \, R y - 2 \, y^{2}} }^{ \sqrt{2 \, R y - 2 \, y^{2}} } x \ {\mapsto}\ \sqrt{R^{2} - x^{2} - y^{2}} = \frac{1}{2} \, {\left(R^{2} - y^{2}\right)} \arcsin\left(\frac{x}{\sqrt{R^{2} - y^{2}}}\right) + \frac{1}{2} \, \sqrt{R^{2} - x^{2} - y^{2}} x
sage: IxT
1/2*T*arcsin(x/sqrt(T)) + 1/2*sqrt(-x^2 + T)*x
sage: integrate(Iz(x),x, algorithm="giac")
1/2*T*arcsin(x/sqrt(T)) + 1/2*sqrt(-x^2 + T)*x
sage: integrate(Iz(x),x, algorithm="fricas")
-1/2*T*arctan(sqrt(-x^2 + T)/x) + 1/2*sqrt(-x^2 + T)*x
sage: integrate(Iz(x),x, algorithm="sympy")
cases(((x^2/T > 1, 1/2*I*x^3/(sqrt(T)*sqrt(x^2/T - 1)) - 1/2*I*T*arccosh(x/sqrt(T)) - 1/2*I*sqrt(T)*x/sqrt(x^2/T - 1)), (1, 1/2*sqrt(T)*x*sqrt(-x^2/T + 1) + 1/2*T*arcsin(x/sqrt(T)))))
edit flag offensive delete link more

Comments

thank you Emmanuel Charpentier

ortollj gravatar imageortollj ( 2020-11-22 14:02:39 +0100 )edit

Will SageMath 9.2 be available soon for W10? (it has been available for some time for Linux Ubuntu)

ortollj gravatar imageortollj ( 2020-11-22 14:10:20 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-11-22 10:56:58 +0100

Seen: 268 times

Last updated: Nov 22 '20