Gabor Grothendieck wrote:
>
> Actually in thinking about this its pretty easy to do it without Ryacas
> too:
>
> Df <- f
> body(Df) <- deriv(body(f), "x")
> Df
>
This is weird.

f <- function(x) { x^2 + 2*x+1 }
Df <- f
body(Df) <- deriv(body(f), "x") # error

Also:

f <- function(x) x^2 + 2 * x + 1
Df <- f
body(Df) <- deriv(body(f), "x") # ok
D2f <- f
body(D2f) <- deriv(body(Df), "x") # error

Alberto Monteiro

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to