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
,
, and
isoclines, the direction field, and the
solution
for the differential equation y' = t - y^2 + 2.
| > | restart; |
| > | with(plots, display, implicitplot, textplot); |
| > | with(DEtools, DEplot); |
############################################################
Plot ranges, the RHS function, and the list of slopes:
| > | TRG := -5..4: YRG := -3..3: |
| > | RHS := (t,y) -> t - y^2 + 2; |
| > | mLIST := [-1,0,1]; Slopes for isoclines |
######################################
Here's a Maple procedure which, given the slope
, 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; |
##############################################################
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)); |
| > | 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]); |
| > | ####################################### |
| > |