t1_prob4_ANS_A10.mws

 t1_prob4_ANS_A10.mws
Mon Oct 10 09:45:25 MDT 2005

A Maple solution to problem 4, Test #1.

The problem was to sketch the m = -1 , m = 0 , and m = 1  isoclines, the direction field, and the y(-1) = -1  solution

for the differential equation y' = t - y^2 + 2.

>    restart;

>    with(plots, display, implicitplot, textplot);

[display, implicitplot, textplot]

>    with(DEtools, DEplot);

[DEplot]

############################################################

Plot ranges, the RHS function, and the list of slopes:

>    TRG := -5..4: YRG := -3..3:

>    RHS := (t,y) -> t - y^2 + 2;

RHS := proc (t, y) options operator, arrow; t-y^2+2 end proc

>    mLIST := [-1,0,1]; Slopes for isoclines

mLIST := [-1, 0, 1]

######################################

Here's a Maple procedure which, given the slope u , produces a labeled plot of the corresponding isocline.

 

>    utah := proc(u)   slope -> labeled isocline
 local tm, ym, us;
 tm := op(2, TRG);
 ym := sort(evalf([solve(RHS(tm,y)=u,y)]))[2];
 us := convert(u, 'string'):  us := "m = "||us:
 implicitplot(RHS(t,y)=u, t=TRG, y=YRG,        colour=BLACK,grid=[75,75]),
   textplot([tm+1/5,ym, us], align={ABOVE,RIGHT}):
end;

utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (
utah := proc (u) local tm, ym, us; tm := op(2,TRG); ym := sort(evalf([solve(RHS(tm,y) = u,y)]))[2]; us := convert(u,'string'); us := (

##############################################################

Now "map" and "utah" generate the list of plots of labeled isoclines.

 

>    isoclineLIST := map(utah, mLIST): Plots of isoclines

>    P := op(isoclineLIST):

#############################################################

Now we set up the differential equation and the y(-1) = -1 initial condition to plot the direction field and the solution curve.

>    DE := D(y)(t) = RHS(t, y(t));

DE := D(y)(t) = t-y(t)^2+2

>    VAR := y(t):

>    INIT := [[y(-1)=-1]]:

>    P := P, DEplot(DE,VAR,t=TRG,INIT,y=YRG, stepsize=0.05):

###############################################################

 

Produce a plot with isoclines, direction field, and the solution curve:

>    display([P]);

[Maple Plot]

>    #######################################

>