[R] External signal in ODE written in C (using deSolve and approx1?)

Thomas Petzoldt thpe at simecol.de
Sun Jun 14 22:37:41 CEST 2009


Glenn Woodart wrote:
> Dear Thomas
> 
> Thank you for your excellent help. I agree method 3 would be the best one,
> and this is the one I have been trying to get working (like you described).
> So far my skills with pointers, what is returned etc in pure C code is
> limited, so my attempts have failed so far. 

That's why I use R for most cases, even if it is somewhat slower than C 
-- is simply much more comfortable.

> If it is possible to get a
> working example in the vignette it would be great.

Yes, this will surely come ..., but for the moment, see the ad-hoc 
example on:

http://www.simecol.de/models/c_ode_signal.zip

You will see that in addition to linear interpolation one needs a method 
to transfer the data of the signal to the C side. There are several 
possibilities and I'm not yet sure which one will eventually find its 
way to the package.

Note also that the code is a quick hack without any warranty.

> Again, thank you for your brilliant work on implementing solvers for
> differential equations in R.
> 
> Best wishes
> Glenn

Thanks for giving feedback.

Thomas Petzoldt




More information about the R-help mailing list