OK. Try this: sapply(expression(x^2+y^3, x^5+y^6), deriv, c("x", "y"))
On Thu, Oct 29, 2009 at 7:11 PM, Rolf Turner <r.tur...@auckland.ac.nz> wrote: > > 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 confidential. If you are > not the intended recipient please delete the message and notify the sender. > Any views or opinions presented are solely those of the author. > > This e-mail has been scanned and cleared by MailMarshal > www.marshalsoftware.com > ###################################################################### > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.