Re: [R] ODE's in R

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Tue, 22 Jan 2008 08:03:21 -0800

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.
>>
>>
>
>
>

______________________________________________
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. Received on Tue 22 Jan 2008 - 16:09:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jan 2008 - 10:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive