Question: Strange behavior of dsolve({ },....,numeric,...

Hi all,

I have the following ODE

> deq := diff(x(t), t) = 1-t-x(t)/t;

                               d                 x(t)
                       deq := --- x(t) = 1 - t - ----
                               dt                 t  
> ci := x(1) = 0;

                               ci := x(1) = 0

If I solve for the exact solution, I have

 

> solex := rhs(dsolve({ci, deq}, x(t)));

                                    1  2   1      1 
                         solex := - - t  + - t - ---
                                    3      2     6 t

then I know that there will be a discontinuity at t=0

But if I do the following:

> p := dsolve({ci, deq}, x(t), type = numeric, range = -1 .. 4);

                        p := proc(x_rkf45)  ...  end;
> plots[odeplot](p, color = navy);


I have a plot that is not the right one if I compare with:

>plot(solex,t=-1..4)

 

What am I missing?

 

Mario

 

Please Wait...