[Pkg-octave-devel] [OctDev] A Bug in Octave-OdePkg

Wang Long mr.wang.long at gmail.com
Wed Oct 8 02:23:17 UTC 2008


On Tue, 2008-10-07 at 23:01 +0200, Thomas Treichl wrote:
> Wang Long schrieb:
> > Hi,
> > 
> > When I was running this in octave:
> > 
> > 	t_in = [0 0.05 0.13 0.19];
> > 	[t_out, y] = ode45 (@(t,x) x, t_in, 1);
> > 
> > I got t_out=[0.00000   0.05000   0.10000   0.15000   0.19000]. While the
> > length of t_in is 4, I found that of t_out is 5 instead of 4. However
> > the length of t_in and t_out should be identical. This bug also exists
> > in ode23, ode54, ode78, etc.
> > 
> > I'm using octave on Ubuntu, and the file "ode45.m" belongs to the
> > package "octave-odepkg" version 0.6.0-1.
> > 
> > Any ideas? Thank you all.
> > 
> > Regards,
> > Wang Long
> 
> Hi Wang,
> 
> please change line number 406 (file ode45.m) originally from
> 
>    vstepsize = vslot(1,vcntloop-1) - vslot(1,vcntloop-2);
> 
> into
> 
>    vstepsize = vslot(vcntloop) - vslot(vcntloop-1);
> 
> Does this fix the ode45 problem for the 0.6.0 release of the package? At least 
> it seems to fix the problem for the latest sources and the next package that 
> will become available.
> 
>    Thomas

Hi Thomas,

Thank you very much in helping me with this problem! The solution in
your email solved the problem I mentioned before, but when I tried some
other t_in's, for example,
  t_in_2=[0.00 0.10 0.23 0.38 0.63 1.21 1.97];
  t_in_3=[0.00 0.03 0.05 0.11 0.17 0.25 0.38 0.47 0.68 0.91 1.38 1.98];
it seems that the same problem comes out again in the 0.6.0 release of
odepkg :(  

I examined the improper t_out's, and found that every element in them is
identical to t_in's, respectively, except those at ``t_out(end-1)'',
which is created by ode45. Therefore, can we simply make ode45 check the
length of t_out, and delete certain elements of t_out (and ``y'', of
course) if the length of t_out is larger than t_in?

Thanks!

Regards,
Wang Long





More information about the Pkg-octave-devel mailing list