Wraps a numeric value as a nested dual with all derivative components zero, representing a constant with respect to the differentiation variable at nesting depth n.

dual_constant_n(x, order)

Arguments

x

A numeric value.

order

A non-negative integer specifying the nesting depth.

Value

A (possibly nested) dual number with zero derivatives.

Examples

k <- dual_constant_n(5, order = 3)
deriv_n(k, 1)  # 0
#> [1] 0
deriv_n(k, 2)  # 0
#> [1] 0
deriv_n(k, 3)  # 0
#> [1] 0