# How to solve a differential equation of degree 5 Anonymous

I tried to solve this equation of degree 5:

$$\dfrac{d^{5}y}{dx^{5}}+5\dfrac{d^{4}y}{dx^{4}}-2\dfrac{d^{3}y}{dx^{3}}-10\dfrac{d^{2}y}{dx^{2}}+\dfrac{dy}{dx}+5y=0$$

with the following code:

x = var('x')
y = function('y')(x)
ED = diff(y,x,5)+5*diff(y,x,4)-2*diff(y,x,3)-10*diff(y,x,2)+diff(y,x)+5*y == 0
desolve(ED,y,contrib_ode=true).show()


This gave the following error:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-9-c048996b444c> in <module>()
2 y = function('y')(x)
3 ED = diff(y,x,Integer(5))+Integer(5)*diff(y,x,Integer(4))-Integer(2)*diff(y,x,Integer(3))-Integer(10)*diff(y,x,Integer(2))+diff(y,x)+Integer(5)*y == Integer(0)
----> 4 desolve(ED,y,contrib_ode=true).show()

/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/calculus/desolvers.pyc in desolve(de, dvar, ics, ivar, show_method, contrib_ode, algorithm)
593             soln = P(cmd)
594             if str(soln).strip() == 'false':
--> 595                 raise NotImplementedError("Maxima was unable to solve this ODE.")
596         else:
597             raise NotImplementedError("Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.")

NotImplementedError: Maxima was unable to solve this ODE.


How can I solve that?

edit retag close merge delete

Sort by » oldest newest most voted

Hello! Sage uses Maxima to solve ODEs. In this particular case, however, Maxima is unable to solve it, and this can be due to one of two reasons: 1. Sage seems to be failing to pass this ODE to Maxima for it to do it's job. Thus, the NotImplementedError. 2. Maxima is not clever enough to solve this ODE. (I really don't know which of these is the case, but I will certainly make some research on it.)

The easiest way to solve this problem is to force Sage to use fricas instead of Maxima. You can do that with the following:

x = var('x')
y = function('y')(x)
ED = diff(y,x,5)+5*diff(y,x,4)-2*diff(y,x,3)-10*diff(y,x,2)+diff(y,x)+5*y == 0
desolve(ED,y,contrib_ode=true,algorithm='fricas').show()


You will get the following: $$_{C_{3}} x e^{\left(-x\right)} + _{C_{1}} x e^{x} + _{C_{2}} e^{\left(-x\right)} + _{C_{4}} e^{\left(-5 \, x\right)} + _{C_{0}} e^{x}.$$

In order to make fricas available to your Sage installation, you will have to run the following command in your terminal: sage -i fricas. Fortunately, thanks to the help of Samuel Lelièvre and Andrey Novoseltsev, fricas is now available in SageCell. You can also use CoCalc (which has fricas already installed) if you don't have a Sage local installation.

Another simple way to solve an equation like this is to convert it to a system: $$y_1 = \frac{dy}{dx}$$ $$y_2 = \frac{dy_1}{dx}$$ $$y_3 = \frac{dy_2}{dx}$$ $$y_4 = \frac{dy_3}{dx}$$ $$\frac{dy_4}{dx}+5y_4-2y_3-10y_2+y_1+5y = 0$$

Then, you can use the desolve_system command:

x = var('x')
y = function('y')(x)
y1 = function('y1')(x)
y2 = function('y2')(x)
y3 = function('y3')(x)
y4 = function('y4')(x)
eq1 = y1 == diff(y, x)
eq2 = y2 == diff(y1, x)
eq3 = y3 == diff(y2, x)
eq4 = y4 == diff(y3, x)
eq5 = diff(y4,x) + 5*y4 - 2*y3 - 10*y2 + y1 + 5*y == 0
sol = desolve_system([eq1, eq2, eq3, eq4, eq5], [y,y1,y2,y3,y4], algorithm='fricas')
sol


In this case, Maxima IS able to solve the system, but the solution is not written in a useful way ---that is why I used fricas also here. For this particular ODEs, when using Maxima, you are going to need to replace the values of y1, y2, y3 and y4 into y, and replace y(0) with _C0, y1(0) with _C1, etc. I don't imagine you wanting to do that, but I am writing the commands anyway, just in case somebody else finds that useful for another system:

x = var('x')
y = function('y')(x)
y1 = function('y1')(x)
y2 = function('y2')(x)
y3 = function('y3')(x)
y4 = function('y4')(x)
eq1 = y1 == diff(y, x)
eq2 = y2 == diff(y1, x)
eq3 = y3 == diff(y2, x)
eq4 = y4 == diff(y3, x)
eq5 = diff(y4,x)+5*y4-2*y3-10*y2+y1+5*y == 0
sol = desolve_system([eq1, eq2, eq3, eq4, eq5], [y,y1,y2,y3,y4])
sol


(... and here comes the process of replacing expressions ...)

I hope this helps!

more

1

Here's a public shared notebook with the code from above. You can run it live with one click and no account creation required: https://share.cocalc.com/share/df81e0...

Note: FriCAS is now available on SageCell as well, thanks to Andrey Novoseltsev. See this 2020-04 sage-cell discussion.