Skip to content
Back to formatted view

Raw Message

Message-ID: <427BE2B9.4040809@bank-banque-canada.ca>
Date: 2005-05-06T21:33:45Z
From: Paul Gilbert
Subject: Numerical Derivative / Numerical Differentiation of unknown funct ion
In-Reply-To: <BDF571786CAD224F966FEB86BEDED52F1433DABB@elon12p32001.csfp.co.uk>

A current version of this code is in the dseplus bundle in the devel
section of CRAN. It does Richardson's extrapolation, which gives an
accurate numerical estimate at the expense of speed. (It does a very
large number of function evaluations.) That may not be what you want.

Paul Gilbert

Uzuner, Tolga wrote:


>Hi,
>
>I have been trying to do numerical differentiation using R. 
>
>I found some old S code using Richardson Extrapolation which I managed to get
>to work.
>
>I am posting it here in case anyone needs it.
>
>
>########################################################################
>richardson.grad <- function(func, x, d=0.01, eps=1e-4, r=6, show=F){
># This function calculates a numerical approximation of the first
>#   derivative of func at the point x. The calculation
>#   is done by Richardson's extrapolation (see eg. G.R.Linfield and
>J.E.T.Penny
>#   "Microcomputers in Numerical Analysis"). The method should be used if
>#   accuracy, as opposed to speed, is important.
>#
>#  *  modified by Paul Gilbert from orginal code by XINGQIAO LIU.
>...
>