# Question:How does the range option affect the way dsolve/numeric and odeplot work?

## Question:How does the range option affect the way dsolve/numeric and odeplot work?

Maple

I recently got stuck on a strange behavior of odeplot which did not return any result (only the axes were drawn).
Convinced that the solution of the differential system was correctly constructed, I noticed that drawing it, without using odeplot, gave me the correct result.
I then discovered that the range option (which I mistakenly defined) was the cause.

But this led me to the following question: what does this option really do?

Here is a notional example. The two questions are at the end of the worksheet.

 > restart:
 > interface(version)
 (1)

EXAMPLE 1

 > sol := dsolve({diff(x(t), t) = t, x(0)=0},numeric, events=[[x(t)=2, halt]], range=0..1)
 (2)
 > # As range is defined up to t=1 and x(t) = t^2/2 = 2 for t=2 it seems "normal" # for the event not to be fired: Tend := sol(eventfired=[1])[]
 (3)
 > # But the limitation induced by range seems ignored by odeplot: plots:-odeplot(sol, [t, x(t)], t=0..4);

EXAMPLE 2

 > sol := dsolve({diff(x(t), t) = t, x(1.1)=0},numeric, events=[[x(t)=2, halt]], range=0..1)
 (4)
 > # For the same reason the event is still not fired here Tend := sol(eventfired=[1])[];
 (5)
 > # odeplot doesn't return any plot. # # This seems logical given that range=0..1 is not consistent with the initial # condition set at t=1.1 # Nevertheless the warning message looks contradictory with the fact that the event is not fired plots:-odeplot(sol, [t, x(t)], t=1.1 .. 4);
 > # Remark: using refine seems to fix this problem plots:-odeplot(sol, [t, x(t)], t=1.1 .. 4, refine=1);
 > # Let's try to plot the solution differently. X := proc(s) eval([t, x(t)], sol(s)) end proc: plot([seq(X(s), s=[seq](1.1 ..4, 0.1))])
 > # Why is the solution calculable? # Why can't odeplot calculate it?
 >

Download The_role_of_range.mw

Please note that the last couple of commands strangely overpasses the < Warning, cannot evaluate the solution further right of 2.2825424, event #1 triggered a halt > limitation.

﻿