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

Gabor Grothendieck ggrothendieck at gmail.com
Thu Oct 29 23:35:00 CET 2009


Try this:

deriv(expression(x^2+y^3, x^5+y^6), c("x","y"))


On Thu, Oct 29, 2009 at 3:31 PM,  <t121 at gmx.net> wrote:
> The deriv() function takes an 'expression' as its first argument). I was
> wondering if the this function can take an array or a vector of
> expressions as its first argument. Aside, I saw how to give a vector
> argument to the second argument.
>
> like to have something like:
> deriv(c(~x^2+y^3, ~x^5+y^6), c("x","y"))
>
> the documentation for this function talks about being able to "returns
> the function values with a gradient attribute containing the gradient
> matrix[!!!]". and I indeed want a matrix of expressions to be returned.
>
> In effect, I want to get the Jacobian.
>
> Thank you, if you have some hints on this.
>
> Tom
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list