Hi Thomas,

ad (2): You're right. I already noticed the same and tried to fix it. I 
think, the best way to avoid this problem is to change line 318 from
vstepsize = vtimestop - vdirection * vtimestamp;
to
vstepsize = vdirection * abs(abs(vtimestop) - abs(vtimestamp));

I didn't carefully check if it solves the problem in general, but I 
think it will.


I changed a few more things, that you may carry over to the official 
version as well:

(1) If you solve an ODE backwards, and want to define InitialStep and 
MaxStep, then you'll notice that InitialStep should be negativ, whereas 
MaxStep couldn't be defined negative (so is supposed to be positive). On 
the one hand it's confusing and on the other hand this leads to problems 
in the algorithm. If you want to fix wrong signs in InitialStep (so, if 
you choose the correct sign in the definition of InitialStep doesn't 
matters any more), you have to replace line 272
     vstepsize = vodeoptions.InitialStep;
by
     if (sign(vodeoptions.InitialStep) == vdirection)
       vstepsize = vodeoptions.InitialStep;
     else %# fix wrong direction of InitialStep
       vstepsize = -vodeoptions.InitialStep;
     end
Furthermore (and this is really a bug!) you should change line 435
vstepsize = max (vodeoptions.MaxStep, ...
to
vstepsize = max (-vodeoptions.MaxStep, ...

(2) In line 349 there is the following variable defined:
     vSaveVUForRefine = vu;
which isn't used in common. So the following if-clause will prevent to 
save that variable if it's not needed:
     if (vhaveoutputfunction && vhaverefine)
       vSaveVUForRefine = vu;
     end

(3) Also a minor change: Add "\n" at the end of "fprintf" in lines 510-512.


If you encounter any problems with these changes, or if you have any 
questions regarding to this, please don't hesitate to write me.

Kind regards,
Nils


Am 04.06.2011 10:23, schrieb Thomas Treichl:
> Hi Nils,
>
> I've taken a look at the solver problem that you've reported:
>
> (1) Looks good and I think that makes sense.
>
> (2) Does not work in general, further, if I take your example
>   f = ode45(@(t,y)y, [0 -1], 1)
>
> and your modified line 316 of the form
>   if (vdirection * (vtimestamp + vstepsize)>  vdirection * vtimestop)
>
> then the output on my machine is
>   error: Solving has not been successful. The iterative integration 
> loop exited at time t = -1.000000 before endpoint at tend = -1.000000 
> was reached. This happened because the iterative integration loop does 
> not find a valid solution at this time stamp. Try to reduce the value 
> of "InitialStep" and/or "MaxStep" with the command "odeset".
>
> Did you use any options to make that work? You're right if you say 
> that the endpoint is not hidden correctly! Looks like we still need 
> another condition. Suggestions?
>
> Best regards
>
>   Thomas


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to