Ask Your Question
2

How to solve higher order (3rd or 4th) differential equation?

asked 2020-12-05 23:06:08 +0200

sonimohit gravatar image

I am new to Sagemath. I was trying to solve ODE of order 4 in sagemath but it gives following error "NotImplementedError: Maxima was unable to solve this ODE."

x=var('x')
w = function('w')(x)
desolve(diff(w,x,4)==1,w,contrib_ode=True)

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2020-12-07 05:53:22 +0200

dsejas gravatar image

Hello, @sonimohit! Please, have a look to this answer that I previously posted on a similar question.

In simple terms, you can use Sage's fricas interface:

x = var('x')
w = function('w')(x)
desolve(diff(w,x,4)==1, w, algorithm='fricas')

Alternatively, you can construct a system of ODEs equivalent to your original equation:

x = var('x')                                                                         
w = function('w')(x)
w1 = function('w1')(x)                                                        
w2 = function('w2')(x)                                  
w3 = function('w3')(x)
w4 = function('w4')(x)
eq1 = w1 == diff(w, x) # first derivative of w
eq2 = w2 == diff(w1, x) # second derivative of w
eq3 = w3 == diff(w2, x) # third derivative of w
eq4 = w4 == diff(w3, x) # fourth derivative of w
eq5 = diff(w4,x) == 1 # this is your original equation
sol = desolve_system([eq1, eq2, eq3, eq4, eq5], [w,w1,w2,w3,w4], algorithm='fricas')
print(sol[0])

I hope this helps!

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: 2020-12-05 23:06:08 +0200

Seen: 75 times

Last updated: Dec 07 '20