Convenience constructor for the independent variable when computing
derivatives. Sets deriv = 1 so that the output's derivative slot
contains \(df/dx\).
dual_variable(x)A dual with value = x and deriv = 1.
x <- dual_variable(2)
deriv(x^2) # 4 = 2*x evaluated at x=2
#> [1] 4