开发者

Maple ODE solving, Graphic is not complete. Why?

So we try to solve simple ODE. We use text book (warning - russian). This is code presented as sample in book (page 18):

> with(DEtools); with(plots);
> eq1 := diff(x(t), t) = y(t); eq2 := diff(y(t), t) = -sin(x(t));

> init := [[x(0) = 1,开发者_运维百科 y(0) = 0], [x(0) = 0, y(0) = 2]];
> DEplot([eq1, eq2], [x, y], t = 0 .. 110, x = -2*Pi .. 2*Pi, init, scene = [x, y], stepsize = 0.5e-1, obsrange = true, color = black, linecolour = black, arrows = 'MEDIUM')

This code shall draw:

Maple ODE solving, Graphic is not complete. Why?

But maple outputs this for me:

Maple ODE solving, Graphic is not complete. Why?

1) Why it solves function only for one quarter?

2) How to make it solve to make it look like in the book?


There does not appear to me to be anything wrong with the plot you're showing. What surprises me more is the plot the book gives, according to what you've pasted above. Think about your initial conditions. The first one is [x(0) = 1, y(0) = 0], which starts at the point (1,0) and moves forward in time by 110 increments (according you your supplied code). This is clearly the interior circle.

Your second set of initial conditions though, [x(0) = 0, y(0) = 2], seems to correctly start where it should (the top of the plot at the point (0,2)) and then it does move along the field lines for what looks to me to be about the same arc length as the smaller interior plot. Judging by the field lines, this makes more sense. One issue could be numerical sensitive at the cusp around the point (pi, 0). If it doesn't get the y-value all the way to zero within machine epsilon, then the next point it will travel to will be climbing back up to the upper right as your plot shows.

Have you tried playing around with slightly different initial conditions and time increments? Try starting from the point (-pi,0) and go for much longer, say t=0..300, and see what happens. Sometimes in books like these, the plot they choose to show is not precisely generated from the code they give you and they fail to mention this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜