[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ode45 inclusion into core
From: |
Juan Pablo Carbajal |
Subject: |
Re: ode45 inclusion into core |
Date: |
Wed, 7 Oct 2015 13:30:02 +0200 |
On Tue, Oct 6, 2015 at 6:02 PM, Richard Crozier <address@hidden> wrote:
>
>
> On 06/10/15 16:33, Carlo De Falco wrote:
>>
>>
>> On 6 Oct 2015, at 09:44, Richard Crozier <address@hidden> wrote:
>>
>>> There is an undocumented feature of matlab's ode45 and most of the other
>>> ode* functions. They pass any additional arguments to ode45 after the
>>> 'options' arguments to the ode evaluation function, crossing detection
>>> function and output function. This is really useful and would be nice to
>>> have in Octave's versions too if it's not present.
>>
>>
>> This feature is present in the current version of ode45 in Octave, but I
>> think it was deprecated in Matlab.
>> The recommended way of achieving the same result is via a anonymous
>> function, i.e., supposing you have
>>
>> function r = resfun (t, y, z)
>> r = t + y + z;
>> endfunction
>>
>> instead of using the deprecated approach of passing the extra parameter z
>> as an additional input to de45:
>>
>> ode45 (@resfun, tspan, y0, options, z)
>>
>> you use an anonymous function to bind the value of z
>>
>> ode45 (@(t, y) resfun(t, y, z), tspan, y0, options)
>>
>> this techinique is reccomended in Matlab [1, 2], but the old behaviour,
>> now deprecated and undocumented, is still
>> working and I think is kept for bacward compatibility.
>>
>> In the Octave implementation I was considering removing this feature as it
>> make the code much more complicated.
>>
>>
>>> Richard
>>
>>
>>
>> c.
>>
>>
>> [1] http://it.mathworks.com/help/matlab/ref/ode45.html "Parameterizing
>> Functions explains how to provide additional parameters to the function fun,
>> if necessary."
>> [2] http://it.mathworks.com/help/matlab/math/parameterizing-functions.html
>>
>
> I know this is deprecated, but I much prefer it to the recommended anonymous
> function method. Please don't remove it if it already exists.
>
> I unfortunately can't remember the exact reasons, but there are issues with
> saving anonymous functions and their data to files that make this way much
> less efficient in my application (I use the multicore package, or rather a
> slightly modified version of it).
>
> Richard
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
Richard,
The bug that prevented saving anonymous functions was fixed in Octconf
Canada a few years ago. Check it out.
- Re: ode45 inclusion into core, Rik, 2015/10/08
- ode45 inclusion into core, Rik, 2015/10/08
- Re: ode45 inclusion into core, Jacopo Corno, 2015/10/08
- Re: ode45 inclusion into core, siko1056, 2015/10/08
- Re: ode45 inclusion into core, Richard Crozier, 2015/10/08
- Re: ode45 inclusion into core, Carlo De Falco, 2015/10/08
- Re: ode45 inclusion into core, Richard Crozier, 2015/10/08
- Re: ode45 inclusion into core,
Juan Pablo Carbajal <=
- Re: ode45 inclusion into core, Carlo De Falco, 2015/10/08
- Re: ode45 inclusion into core, Olaf Till, 2015/10/08
- Re: ode45 inclusion into core, Richard Crozier, 2015/10/08
- Re: ode45 inclusion into core, Olaf Till, 2015/10/08
- Re: ode45 inclusion into core, Richard Crozier, 2015/10/08