Question: Numerical solution of ODE with singularities

Hi all,

while studying this ODE

> deq := diff(y(x), x) = x^2-y(x)^2;

                                d          2       2
                        deq := --- y(x) = x  - y(x) 
                                dx                  
> ci := y(0) = 1;

                               ci := y(0) = 1
> solex := rhs(dsolve({ci, deq}, y(x)));

and analysing the exact solution (wich is impressive - thanks Maple), I see that there is a singularitie at x = −1.037489135

I want to see how  the  numerical solution will deal that situation. So I do:

 

> solnum := dsolve({ci, deq}, numeric, y(x), range = -2 .. 2);

Warning, cannot evaluate the solution further left of -1.0374891, probably a singularity
                     solnum := proc(x_rkf45)  ...  end;

Not being a speciallist on numerical method, I am happy to see that Maple find the singularitie.  With this command, I can plot the numerical solution and see that it is a good approximation of the real solution for the right part of the singularitier. 

>plots[odeplot](solnum, x = -2 .. 2, color = green);

Warning, cannot evaluate the solution further left of -1.0374891, probably a singularity

But trying to plot the left side of the singularitie is not working even though I do the following:

> solnumr := dsolve({ci, deq}, numeric, y(x), range = -2 .. -1.04);

Warning, cannot evaluate the solution further left of -1.0374891, probably a singularity

>plots[odeplot](solnumr, x = -2 .. -1.04, color = green);

Warning, cannot evaluate the solution further left of -1.0374891, probably a singularity

The plot is empty.

My question is:  How can I define a piecewise fucntion that will make me able to plot the left and the right side of  the singularitie?

Thanks in advance!

Mario

 

 

 

 

 

 

Please Wait...