枫树中非线性DE的泰勒级数与数值解

时间:2018-12-30 07:04:48

标签: maple

我想绘制两个图:DE的数值解和给定DE的泰勒级数逼近。我有

de := diff(y(x), x$2) = x+y(x)-y(x)^2;
cond := y(0) = -1, (D(y))(0) = 1;
stp := 0.1e-1;
a, b := -5, 30;
numpts := floor((b-a)/stp+1);
p := dsolve({cond, de}, y(x), numeric, stepsize = stp, output = listprocedure); 

绘制eval会产生奇怪的垂直线,而我希望获得的图似乎会像x -> ∞那样振荡。对于泰勒系列,我尝试过f:=[seq(taylor(y(x),x=i,n),i=-5..30 by stp)];,但似乎无法以这种方式工作。我该怎么办?为什么我的情节与预期不同?

1 个答案:

答案 0 :(得分:1)

restart;
kernelopts(version);

    Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750

de := diff(y(x), x$2) = x+y(x)-y(x)^2:
cond := y(0) = -1, (D(y))(0) = 1:
stp := 0.1e-1:
a, b := -5, 30:
numpts := floor((b-a)/stp+1):

p := dsolve({cond, de}, y(x), numeric, stepsize = stp,
            output = listprocedure):

Y:=eval(y(x),p);

                Y := proc(x)  ...  end;

plot(Y, 0..20);

enter image description here

Order:=10:
S := convert(rhs(dsolve({cond, de}, {y(x)}, series)),polynom);

plot([S, Y(x)], x=0..1.5);

enter image description here

Order:=40:
S := convert(rhs(dsolve({cond, de}, {y(x)}, series)),polynom):

plot([S, Y(x)], x=0..2.0);

enter image description here