[R] Using uniroot() with output from deriv() or D()

2011-02-26 Thread jjheath
I need to find the root of the second derivative of many curves and do not want to cut and paste the expression results from the deriv() or D() functions every time. Below is an example. What I need to do is refer to fn2nd in the uniroot() function, but when I try something like

Re: [R] Using uniroot() with output from deriv() or D()

2011-02-26 Thread jjheath
Hans, Both your methods worked great! They was exactly what I was looking for. I ended up using the second method as it is a little more efficient: fn2nd_fun - function(x) eval(fn2nd, list(x=x)) ex - seq(from=0, to=1, length.out = 1000) y1 - fn2nd_fun(ex) ... r -