slope_field.mws

Slope fields slope_field.mws

Here's one way to make a slope field for the first-order differential equation
dy/dt = 2*sin(t) - y .

First load the package that includes "fieldplot":

> with(plots):

Warning, the name changecoords has been redefined

Now we want to draw little line segments with the slope specified by the differential equation.
This can be done as follows. Dividing by "len" is to make all the line segments the same length.:

> slope:=2*sin(t)-y;
len:=sqrt(1+slope^2):
fieldplot( [1/len,slope/len],
t=0..5, y=-6..6, arrows=line, color=blue );

slope := 2*sin(t)-y

[Maple Plot]

If you don't put in "arrows=line", you get arrow-heads on your mini-tangents.

As with other plots, you can click on the plot and use the rectangular frame to resize the plot.

>