[R] ODE's in R
Markku Karhunen
markku.karhunen at ktl.fi
Wed Jan 23 10:53:37 CET 2008
Thank you all.
We must think about implementing these packages. In the meantime, I
should clarify my question: Is there any evidence that doing the dumb
for loop discretisation is any more dangerous in R, than in any other
language? Apparently not?
Best,
Markku Karhunen
> have you looked at lsoda{odesolve}?
>
> have you looked at the scripts\CSTR subdirectory in the fda package?
> it includes an example worked in both R and Matlab with slightly
> better answers in R but with a much longer compute time.
>
> sg
>
> The fda package
>
> Peter Dalgaard wrote:
>> Markku Karhunen wrote:
>>
>>> Thanks, Dr. Maechler.
>>>
>>>> No, there's no such track.
>>>> [ Matlab users coming to R may produce wrong R code
>>>> by using 0:n-1 instead of 0:(n-1) ; but I don't assume this
>>>> would be the case ]
>>>>
>>>>
>>> Been there, done that!
>>>
>>>> MK> We use just a simple discretisation written in a for loop
>>>> MK> and a variable (i.e. user-fed) time step.
>>>>
>>>> I don't think you should use your own code instead of "professional"
>>>> ODE solvers, such as the one in R package 'odesolve'....
>>>>
>>>>
>>> We must look into that. The problem, maybe, is that in fact half of
>>> the equations are, in fact, simple PDE's and I don't know, if you
>>> can put them into odesolve.
>>>
>> Usually, you can convert them to a system of ODE's ("the method of
>> lines" if i remember correctly).
>>
>> One slight caveat with the high-end ODE solvers is that sometimes they
>> are too smart for their own good when used in connection with parameter
>> estimation. Because of things like adaptive stepsizing, you might end up
>> with sums of squared residuals that are non-smooth functions of the
>> parameters. This happens especially easily if the system itself is not
>> quite smooth (e.g. if your input to the system is a step function).
>>
>>
>>>> MK> Maybe, I'm too neurotic about this, but I guess I just want
>>>> some comfort MK> after seeing a few particularly nasty orbits.
>>>>
>>>> As we know ``from Chaos theory'', there can be delicate
>>>> inhereent and numerical problems in ODE solving..
>>>>
>>> But - to our best knowledge - they should not be any more acute in
>>> R, than on any other platform...
>>>
>>> BR,
>>> Markku
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
More information about the R-help
mailing list