From: Joerg van den Hoff <j.van_den_hoff_at_fz-rossendorf.de>

Date: Mon 12 Jun 2006 - 21:59:20 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jun 12 22:04:00 2006

Date: Mon 12 Jun 2006 - 21:59:20 EST

ZhanWu Dai wrote:

> I am an initial user of R. Could you give me some explanations or examples on how to solve the first order differential equations by the first-order Runge-Kutta method?

*>
**> Thank you very much
**>
**> Kind regards
**>
**>
**>
**> ------------------------------------------------------------------------
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
*

not really an answer, but a remark:

if your ODE is of the form

dy

--- - k y = A f(x)

dx

(k, A const.) it might be a better idea to use the 'analytic' solution instead of runge-kutta (faster, probably more accurate). for instance, if the initial condition is

y(x=0) = 0

and you're looking only at x>0 the solution simply is

y(x) = A (x) {*} exp(-kx)

where {*} means the finite (continous) convolution extending from 0 to x:

y(x) = A integral from z=0 to z=x {f(z) exp(-k(x-z)) dz}

(which, of course, still has to be computed numerically in general.)
this closed-form solution can then

be used, for instance, to determine the unknown parameters (k, A) from a
least squares fit to measured f(x), y(x)

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jun 12 22:04:00 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Tue 13 Jun 2006 - 00:11:58 EST.

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