[Rd] Automatic Differentiation for R
John C Nash
nashjc at uottawa.ca
Tue May 19 15:18:08 CEST 2009
Martin (see below) gives a good explanation of the difference between AD and symbolic
differentiations. I'm of the opinion we can use both. However, the real issue as far
as I'm concerned (from an optimizer's point of view, which may also be that of ODE and
PDE folk) is that right now none of the offerings that we have are easy to use. Indeed,
usability is one of the key issues in my current efforts to improve optimization tools.
There are several people in UK from both AD and R sides who are communicating,
an initiative that Shaun F. helped get going. I'm copying the folk I think are
involved -- forgive omissions and pass things along please. The main purpose of this
message is to ensure Martin's offer is noted, as in my opinion his knowledge of the
R internals is very valuable.
Cheers, JN
[MM stumbling over on old thread ... he'd be interested]
>>>>> >>>>> "GaGr" == Gabor Grothendieck <ggrothendieck at gmail.com>
>>>>> >>>>> on Wed, 15 Apr 2009 09:53:18 -0400 writes:
>>>>>
GaGr> Not sure if this is sufficient for your needs but R does include symbolic
GaGr> differentiation, see ?D, and the Ryacas and rSymPy
GaGr> packages interface R to the yacas and sympy computer algebra
GaGr> systems (CAS) and those system include symbolic differentiation.
No, symbolic differentiation is not enough.
Automatic Differentiation (AD) is something much more general (in one
way) and much less mathematical from a classical view point:
But then, AD is much more generally useful for minimization as, basically,
the input is an R function
f(x) {with x multidimensional}
or f(x1,x2, ..., xp) {with scalar x1, x2, ..}
and the output is again an R function
which computes f() and all {or just selected} partial
derivatives d f / d{xi}.
Now consider that the function f() can contain if() and while()
clauses and conceptually ever language feature of R.
In practice, I'm pretty sure the list of features would have to
be restricted, similarly as they'd have to for an R compiler to
be feasible.
I agree that AD for R would be very nice and could be very
useful.
I'd also be interested to help AD people learn the S4 classes
and methods (hoping that it's close enough to what they call
"operator overloading" something I'd presume to be less general
than the powerful S4 class/methods system).
Martin Maechler, ETH Zurich
More information about the R-devel
mailing list