Section4.3Plotting Trajectories¶ permalink
A differential equation with an initial condition will uniquely determine a solution function so long as the <<Unresolved xref, reference "thm-diffeq-existence"; check spelling or use "provisional" attribute>>. Computers can help us approximate these solutions numerically even when it is not possible to find explicit formulas. To do this, however, they only give the approximate values of the function at specific requested points.
Sage is able to solve differential equations numerically. Be aware that how much of the solution you try to find can lead to success or failure. If the solution changes rapidly or becomes unbounded, the computer can return an error or give meaningless results. It is a good practice to think about how fast the function will change and choose your interval appropriately.
For our example, we will look at the differential equation defined by \begin{equation*}\frac{dy}{dt} = ty-y^2\end{equation*} with initial condition \(y(0)=1\). We will use a numerical scheme called the Runge-Kutta 4th-order method. The initial value corresponds to a point in the \((t,y)\) plane of \((t,y)=(0,1)\).
If we want to solve the differential equation multiple times with different initial conditions and show all of the solutions on the same figure, we can do this as well. We will create a trajectory plot and then add additional solutions to it.