
numD(formula, ..., .hstep = NULL, add.h.control = FALSE)setInterval(C, wrt, h)
setCorners(C, var1, var2, h)
dfdx(.function, .wrt, .hstep)
d2fdxdy(.function, .var1, .var2, .hstep)
d2fdx2(.function, .wrt, .hstep)
numerical.first.partial(f, wrt, h, av)
numerical.second.partial(f, wrt, h, av)
numerical.mixed.partial(f, var1, var2, h, av)
plotFun
).hstep
argument that cann be used to demonstrate convergence and errornumD
and
D
easier to read..hstep
is set, by default, to give reasonable results for first- and second-order derivatives.
It's tweaked a bit so that taking a second derivative by differentiating a first derivative
will give reasonably accurate results. But,
if taking a second derivative, much better to do it in one step to preserve numerical accuracy.D
, symbolicD
, makeFun
, antiD
, plotFun
g = numD( a*x^2 + x*y ~ x, a=1)
g(x=2,y=10)
gg = numD( a*x^2 + x*y ~ x&x, a=1)
gg(x=2,y=10)
ggg = numD( a*x^2 + x*y ~ x&y, a=1)
ggg(x=2,y=10)
h = numD( g(x=x,y=y,a=a) ~ y, a=1)
h(x=2,y=10)
f = numD( sin(x)~x, add.h.control=TRUE)
plotFun( f(3,.hstep=h)~h, hlim=range(.00000001,.000001))
ladd( panel.abline(cos(3),0))
Run the code above in your browser using DataLab