Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
227 views

Slope Fields

Cosider the differential equation: dydx=f(x,y)\frac{dy}{dx}=f(x,y)

This differential gives a formula to compute the slope of any solution curve at any point (x,y)(x,y).

For Example: y=x+yy'=x+y We can display the requirement that the tangent slope at every point on a solution curve be equal to x+yx+y with a slope field.

x,y=var('x,y') f(x,y)=x+y sf=plot_slope_field(f(x,y),(x,-3,3),(y,-3,3),aspect_ratio=1,figsize=8) sf

We can solve the differential equation using a CAS:

y=function('y',x) sol=desolve(diff(y,x)==x+y,y) show(expand(desolve(diff(y,x)==x+y,y)))
Cexx1\displaystyle C e^{x} - x - 1

Every member of the family of curves y=Cexx1y=Ce^x-x-1 must be tangent to an element of the slope field at every point.

slns=sum([plot(C*e^x-x-1,(x,-3,3),ymin=-3,ymax=3) for C in srange(-3,3,.2)]) sf+slns

Slope Fields and IVPs

Consider the IVP: ParseError: KaTeX parse error: Undefined control sequence: \array at position 8: \left\{\̲a̲r̲r̲a̲y̲{\frac{dy}{dx}&…

The initial condition y(x0)=y0y(x_0)=y_0 specifies a particular solution among the family of curves that satisfy y=f(x,y)y'=f(x,y).

Example

ParseError: KaTeX parse error: Undefined control sequence: \array at position 8: \left\{\̲a̲r̲r̲a̲y̲{\frac{dy}{dx}&…

The general solution to y=x+yy'=x+y was already found to be the family of curves y=Cexx1y=Ce^x-x-1 (where CC is an arbitrary real number), and we can use the initial condition to specify CC:

ParseError: KaTeX parse error: Unknown column alignment: 0 at position 15: \begin{array} 0̲.75 &=& y(0.25)…

This value of CC specifies a particular member of the family of solutions to the ODE y=x+yy'=x+y.

pnt=list_plot([(.25,.75)],color='red',size=100) IVP_sln=plot((2/exp(.25))*e^x-x-1,(x,-3,3),ymin=-3,ymax=3,color='red') IVP_sln+sf+slns+pnt