Why can't DEplot plot the part of a solution to a differential equation to the left of a singularity?

256 Views Asked by At

I'd like to plot the solution to the differential equation

$$\frac{d}{dx}y(x)=\frac{(y-1)^2}{(x+1)^2}$$

with initial value condition $y(0)=0$.

The solution is $$y(x)=\frac{x}{2x+1}$$

Clearly, this function is not defined for $x=-\frac{1}{2}$, a vertical asymptote in the graph of this function.

In Maple, I define the differential equation and plot the solution for the initial condition with commands:

ode := diff(y(x), x) = (y(x) - 1)^2/(x + 1)^2
with(DETools);
DEplot(ode2, y(x), x = -5 .. 5, [[y(0) = 0]]);

And the result is a plot with a warning. The warning is:

Warning, plot may be incomplete, the following errors(s) were issued:cannot evaluate the solution further left of -.49999997, probably a singularity

Plot of solution to differential equation with direction field

If I try to plot avoiding the vertical asymptote (singularity) in the graph, Maple doesn't plot anything at all, but does give the same warning as before:

DEplot(ode2, y(x), x = -5 .. -1, [[y(0) = 0]]);

How come Maple can't even plot when I avoid the singularity altogether? Also, how come it just can't plot the part of the function to the left of the singularity?

1

There are 1 best solutions below

4
On BEST ANSWER

DEplot uses numerical methods, not the explicit solution formula, so it starts from $x=0$ and constructs an approximate solution step by step, and when things blow up at the singularity, there is no way for the numerical method (which doesn't know the explicit solution formula) to know where the solution is supposed to “come back” on the other side.

By the way, even if you know the solution formula, it's doubtful whether the part to the left of $x=-1/2$ can meaningfully be considered as a part of the solution to an initial value problem with $y(0)$ given, at least if you consider the ODE in the real domain. (If you let $x$ be complex, it's a different matter, since then you can go around the singularity in the complex plane.)

(And by the way too, there is also something funny going on when $(x,y)=(-1,1)$.)