Second order differential equation in Julia

2.5k Views Asked by At

I'm new to Julia programming I managed to solve some 1st order ODE, but when I thought to move to the second order I don't know how to use the solver to implement to the required equation.

I want to solve this equation

y" + y = 0

with initial conditions

y(0) = 3
y'(0) = -0.5

How can I do this?

1

There are 1 best solutions below

0
On

change it to y'' = -y and then use SecondOrderODEProblem, i.e. https://diffeq.sciml.ai/stable/types/dynamical_types/, via:

SecondOrderODEProblem((v,u,p,t)->-u,-0.5,3.0,(0.0,1.0))

For more examples of this, see the Classical Physics Problems tutorial:

https://tutorials.sciml.ai/html/models/01-classical_physics.html