bugGNU Octave - Bugs: bug #49190, no return to prompt by ode45()...

 
 

bug #49190: no return to prompt by ode45() when blowup of solution occurs

Submitter:  Andreas Stahel <sha1>
Submitted:  Mon 26 Sep 2016 11:58:22 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  cdf
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.0-rc2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 27 Sep 2016 12:37:26 PM UTC, comment #5: 

Andreas,

The 'problem dependence' is given by the fact
that the choice of minimum time step for which
to stop integrating is given by the location of
the blow up, i.e., for

x'= 1+x^2 => blowup at t=pi/2

the integration will stop when the
estimated dt = eps(pi/2) = 2.2204e-16

for

x'= 2*(1+x^2) => blowup at t=pi/4

the integration will stop when the
estimated  dt = eps(pi/4) = 1.1102e-16

AFAIU, in the old version the minimum time
step was computed as eps (tspan(2) - tspan(1))
which would have been eps (2) = 4.4409e-16
in both cases.

the choice made by matlab also depends on the
problem (i.e. it depends on the location of
the blow-up) but the value that matlab chooses
is consistently larger than mine and I couldn't
find anywhere documentation of its particular choice


c.



Carlo de Falco <cdf>
Group Member
Tue 27 Sep 2016 08:51:25 AM UTC, comment #4: 

Hello Carlo

Thank you for the quick fix.
This is Open Source at its best!

The "feature" might not be problem dependent after all.
The exact solutions blow up at different times

x'= 1+x^2 with x(0)=0 solved by x(t) = tan(t), blowup at t=pi/2
x'= 2*(1+x^2) with x(0)=0 solved by x(t) = tan(2*t), blowup at t=pi/4
If the stepsize is made smaller and smaller, (since x(t) is larger and larger), the solvers will slow down. With a minimal step size, it will stop.

Thank you for the patch

Andreas


Andreas Stahel <sha1>
Tue 27 Sep 2016 08:46:15 AM UTC, comment #3: 

Hi,

I pushed this changeset that should solve the issue:
http://hg.savannah.gnu.org/hgweb/octave/rev/21c89e691804

Actually the push was unintentional because the minimum
value for the timestep now used for stopping the integration
is much smaller than what is used in matlab and I suspect this
may sometimes not work, anyway it is an improvement and should
do no harm (all existing tests still pass) so I don't see a
problem with getting this into the 4.2 release.


Carlo de Falco <cdf>
Group Member
Mon 26 Sep 2016 03:01:36 PM UTC, comment #2: 

It seems the old version was using


vminstepsize = (tspan(end) - tspan(1)) / (1/eps);


which is not the same as Matlab and is not dependent
on the particular problem beinf solved.

Carlo de Falco <cdf>
Group Member
Mon 26 Sep 2016 02:38:29 PM UTC, comment #1: 

Hi,

Thanks for reporting this.

I tested the same example in Matlab
and it seems what happens there is
that the simulation is stopped issuing
a warning when the timestep becomes too
small.

I was not able to find documentation
of the value being set for the minimum
timestep though. Some testing seems to
indicate this is problem dependent ...


[t,x]=ode45(@(t,x)2*(1+x.^2),[0,2],0);
Warning: Failure at t=7.853880e-01.  Unable to meet integration tolerances without reducing the step size below the smallest value allowed
(1.776357e-15) at time t.
> In ode45 (line 308)
>> [t,x]=ode45(@(t,x)1+x.^2,[0,2],0);
Warning: Failure at t=1.570767e+00.  Unable to meet integration tolerances without reducing the step size below the smallest value allowed
(3.552714e-15) at time t.
> In ode45 (line 308)


any idea what would be a reasonable to select this value?

c.

Carlo de Falco <cdf>
Group Member
Mon 26 Sep 2016 11:58:22 AM UTC, original submission:  

Dear developers

when calling
[t,x]=ode45(@(t,x)1+x.^2,[0,2],0)
Octave does not return to prompt at all
while
[t,x]=ode45(@(t,x)1+x.^2,[0,1],0)
leads to a correct result
The exact solution of the ODE is x(t) = tan(t)
Thus the failing situation is running into a blowup of the solution.

The "old" package odepkg solves the problem with an appropriate warning message.

Andreas Stahel <sha1>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cdf (Posted a comment)
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf
  • -email is unavailable- added by sha1 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-27 cdf Open/ClosedOpen Closed
    2016-09-26 cdf Assigned toNone cdf
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code