如何使用maple 12绘制和求解这个微分方程?

时间:2013-04-07 10:16:20

标签: maple differential-equations

考虑具有初始条件$y^{\prime}=y-2$的微分方程$y\left(0\right)=1$

a)使用Euler方法,使用4个大小为0.2的步骤来估计$y\left(0.8\right)$

我知道怎么用手做;但是,我安装了枫木12,并试图弄清楚如何使用Maple,然后制作一个显示该功能的每一步的图表。有什么建议。我曾尝试过查看mapleprimes,但它一直指向我更新版本的maplesoft的功能,我没有。

我发布这个问题用作模型,因为我已经手动解决了这个问题,它将帮助我编辑其他微分方程。

PS。我希望这是提出这个问题的合适场所,如果没有,请告诉我哪里会更好。

1 个答案:

答案 0 :(得分:1)

restart:

sys := diff(y(x),x) = y(x) - 2;
IC := y(0) = 1;

sol := dsolve({sys,IC}, numeric,
          output = listprocedure,
          method = classical[foreuler], stepsize = 0.2):
yest := eval(y(x),sol):

for i from 1 to 4 do
  yest(0.2*i);
end do;

Peul:=plots:-odeplot(sol,x=0..1):
Peul;

exactsol:=dsolve({sys,IC});
yexact:=eval(y(x),exactsol);

for i from 1 to 4 do
  eval(yexact,x=0.2*i);
end do;

Pexact:=DEtools[DEplot](sys,y(x),x=0..1,[[y(0)=1]]):

plots:-display([Pexact,Peul],color=[green,red]);