It's pretty hard to debug something when all we are told is "it is
giving me an error".
Take a specific example, (e.g. which we know will be dead flat at (0,0),
just as a check). Here's one way to do it:
Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary): +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
mailto:Bill.Venables at csiro.au
http://www.cmis.csiro.au/bill.venables/
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Lavan
Sent: Tuesday, 25 March 2008 10:00 AM
To: r-help at r-project.org
Subject: [R] derivatives in R
Hi, I posted this message earlier in "Rmetrics" and I don't know whether
I
posted in the wrong place, so I'm posting it again in Rhelp.
I have a function in x and y and let's call it f(x,y). I need to get the
Hessian matrix. i.e I need (d^2f/dx^2), (d^2f/dxdy), (d^2f/dydx),
(d^2f/dy^2). I can get these using the D function. now I need to
evaluste the
hessian matrix for -5<x<5 and -2<y<2 and I also need to print the
output.
I tried using a for loop, but it is giving me an error.
Thanks