Ask Your Question
0

2-order differential equation with parameters

asked 2023-09-08 13:24:12 +0100

antrock1999 gravatar image

I have to solve the following differential equation with parameters on Sagemath but I don't know how to declare de parameters. The differential equation is the following: diff(y,x,2)x+diff(y,x)(2k+1-2x^2)+y(E-2k-2)x == 0 where E and k are paramaters. Any help?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-09-08 22:46:52 +0100

Emmanuel Charpentier gravatar image

What's wrong with :

sage: E, k=var("E, k")
sage: y=function("y")
sage: de=y(x).diff(x, 2)*x+y(x).diff(x)*(2*k+1-2*x^2)+y(x)*(E-2*k)*x==0
sage: desolve(de,y(x),ivar=x, contrib_ode=True)
[y(x) == _K1*hypergeometric_M(-1/4*E + 1/2*k, k + 1, x^2) + _K2*hypergeometric_U(-1/4*E + 1/2*k, k + 1, x^2)]

[ FWIW, Sympy's dsolve doesn't seem to be able to solve this one...]

Neither Sage, Fricas, Giac nor Sympy seem to be able to check "easily" this soluion analytically. But Mathematica (the gratis WolframEngine 13.2 here) can :

sage: Sol=desolve(de,y(x),ivar=x, contrib_ode=True) ; Sol # Same as before...
[y(x) == _K1*hypergeometric_M(-1/4*E + 1/2*k, k + 1, x^2) + _K2*hypergeometric_U(-1/4*E + 1/2*k, k + 1, x^2)]
sage: y0(x)=Sol[0].rhs()
sage: de.substitute_function(y,y0)._mathematica_().FullSimplify()
True

Alternatively :

sage: de.substitute_function(y,y0).lhs()._mathematica_().FullSimplify()
0

A numerical check could be done with Sage alone by substituting random numerical values for _K1 and _K2 and plotting the de's left hand on the domain(s) of interest.

HTH,

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2023-09-08 13:24:12 +0100

Seen: 148 times

Last updated: Sep 08 '23