[R] deriv() to take vector of expressions as 1st arg?

Rolf Turner r.turner at auckland.ac.nz
Fri Oct 30 00:11:48 CET 2009


On 30/10/2009, at 11:35 AM, Gabor Grothendieck wrote:

> Try this:
>
> deriv(expression(x^2+y^3, x^5+y^6), c("x","y"))

Did *you* try it Gabor?  I did just now and it returns only
the gradient of the first component:

  > deriv(expression(x^2+y^3, x^5+y^6), c("x","y"))
expression({
     .value <- x^2 + y^3
     .grad <- array(0, c(length(.value), 2L), list(NULL, c("x",
         "y")))
     .grad[, "x"] <- 2 * x
     .grad[, "y"] <- 3 * y^2
     attr(.value, "gradient") <- .grad
     .value
})

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list