First and second (numerical) derivative of density function?

1.3k views Asked by At

What is the most accurate way to compute F''(x) and F'''(x) for a range of values of x if only F'(x) is known to R (for example take F to be the Gaussian)?

1

There are 1 answers

0
modulus On BEST ANSWER

You could use the D()function to compute F''(x) if you know F'(x). For example if F'(x) is 4*x^3 then to calculate the second derivative (F''(x)) you enter:

> D(expression(4*x^3), 'x')
 4 * (3 * x^2)

To calculate F'''(x) you do the same thing with the given output (4 * (3 * x^2)).