[Go to the Notes on Diffy Qs home page]

Notes on Diffy Qs - Sage demos for section 3.1

Press the Evaluate button below to launch the Sage demonstration.

Solving systems of ODE

Similarly to how you can ask Sage to solve one ODE, you can ask it to solve a system. Here we solve the system \(x' =x-y, y'=x+y+t.\) Note that the solver only succeeds in cases when Sage can find an analytic solution, otherwise you get an error.

We could also put in some initial equations. Here, the vector given as "ics" represents the initial t, initial x, and initial y. So for example, to solve for the initial conditions \(x(0)=1,y(0)=2\) you use "[0,1,2]".

Plotting vector fields for autonomous system of ODE

If we have an autonomous system of two ODE we can plot the vector field in the following way. Here we plot \(x' = x\sin(\pi y), y'=x-y.\)


Valid HTML 5 Valid CSS!