Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Stream Line Plots

Views: 128
Kernel: SageMath (stable)

Streamline Plots

Example: Vector field in the phase plane

{dxdt=0.3x−0.2xy$6pt]dydt=−0.2y+0.1xy\begin{cases}\dfrac{dx}{dt} &= 0.3x-0.2xy $6pt] \dfrac{dy}{dt} &= -0.2y+0.1xy \end{cases}
var('x, y, t') F=(0.3*x-0.2*x*y, -0.2*y+0.1*x*y) ans=desolve_odeint(F,[1,1],srange(0,40,0.1),[x,y],ivar=t) pp=streamline_plot(F, (x, 0, 4), (y, 0, 4),density=2, color='gray') soln=line(ans,thickness=3) pp+soln
Image in a Jupyter notebook

Example: Direction field

dydx=0.5y(1−y5)(y−10)\frac{dy}{dx} = 0.5 y \left(1-\frac{y}{5}\right) (y-10)
streamline_plot(0.5*y*(1-y/5)*(y-10),(x,0,10),(y,0,15))
Image in a Jupyter notebook