Recursively nests dual numbers to enable exact computation of
derivatives up to order n. The variable is seeded so that
after evaluating a function f, the k-th derivative can be
extracted with deriv_n(result, k).
dual_variable_n(x, order)A (possibly nested) dual number.
# 3rd derivative of x^4 at x=2: 4*3*2*x = 24*2 = 48
x <- dual_variable_n(2, order = 3)
r <- x^4
deriv_n(r, 3) # 48
#> [1] 48