[R] higher derivatives using deriv

2012-01-03 Thread alexander16
Dear everyone, the following is obviously used to compute the nth derivative, which seems to work (deriv(sqrt(1 - x^2),x,n)) However, before using this, I wanted to make sure it does what I think it does but can't figure it out when reading the ?deriv info or any other documentation on deriv for

Re: [R] higher derivatives using deriv

2012-01-03 Thread Ted Harding
See in-line below. On 03-Jan-2012 alexander16 wrote: Dear everyone, the following is obviously used to compute the nth derivative, which seems to work (deriv(sqrt(1 - x^2),x,n)) Well, it doesn't seem to work for me! In fact: n - 2 (deriv(sqrt(1 - x^2),x,n)) # Error in deriv(sqrt(1 -

Re: [R] higher derivatives using deriv

2012-01-03 Thread Spencer Graves
I suggest you look at the help pages for expression and evel, then consider the following example in addition to the function DD in the examples for deriv: Dxy - deriv( ~x*y*z, c('x', 'y')) x - 2; y - 3; z - 4 eval(Dxy) Dxy.fn - deriv(expression(x*y*z), c('x', 'y'), TRUE) Dxy.fn Dxy.fn(x, y)

Re: [R] higher derivatives using deriv

2012-01-03 Thread alexander16
Dear Spencer, Dear Ted, thanks for your quick and detailled answers. I should have indicated that I use the Ryacas package - for example: library(Ryacas) x - Sym(x) Simplify(deriv(x^3),x,2)) Just now I have realized that the deriv function is translated to the Deriv function in yacas, which