## specify the function string
f.str <- "x^alpha"

## higher derivatives 
DD <- function(f.str, x = 2, alpha=3,order = 1){
expr.s <- parse(text=f.str)
while(order>=1) {
expr.s <- D(expr.s,"x")
order <- order-1}
eval(expr.s)
}

compute
DD(f.str,x=1,alpha=0.5,order=1)

-----
A R learner.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-get-higher-derivatives-with-deriv-tp2306711p2307241.html
Sent from the R help mailing list archive at Nabble.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.

Reply via email to