Slope Field

Author

Eric W. Weisstein
June 3, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Graphics/SlopeField.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/SlopeField.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<Graphics`PlotField`

Examples

<<Graphics`Colors`

curve[y0_,color_:Red]:=Plot[Evaluate[NDSolve[{y'[x]==x+y[x],y[-3]==y0},y,{x,-3,3}][[1,1,-1]][x]],{x,-3,3},PlotStyle->color,DisplayFunction->Identity][[1]]

PlotVectorField[#/Norm[#]&[{1,x+y}],{x,-3,3},{y,-3,3},Axes->True,PlotPoints->20,ScaleFactor->.25,Prolog->{curve[#,Hue[(#+3)/6]]&/@Range[-3,3,.2]}]

curve[y0_,color_:Red]:=Plot[Evaluate[NDSolve[{y'[x]==x+Sin[y[x]],y[-3]==y0},y,{x,-3,3}][[1,1,-1]][x]],{x,-3,3},PlotStyle->color,DisplayFunction->Identity][[1]]

PlotVectorField[#/Norm[#]&[{1,x+Sin[y]}],{x,-3,3},{y,-3,3},Axes->True,PlotPoints->20,ScaleFactor->.25,Prolog->{curve[#,Hue[(#+10)/20]]&/@Range[-10,10,.2]}]

curve[y0_,color_:Red]:=Plot[Evaluate[NDSolve[{y'[x]==1+(1+y[x]^2)Cos[x],y[-3]==y0},y,{x,-3,3}][[1,1,-1]][x]],{x,-3,3},PlotStyle->color,DisplayFunction->Identity][[1]]

PlotVectorField[#/Norm[#]&[{1,(1+y^2)Cos[x]}],{x,-3,3},{y,-3,3},Axes->True,PlotPoints->20,ScaleFactor->.25,Prolog->{curve[#,Hue[(#+5)/10]]&/@Range[-5,5,1]}]