dual_constant_n: Create a constant dual for n-th order differentiation

View source: R/dual-higher.R

dual_constant_nR Documentation

Create a constant dual for n-th order differentiation

Description

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.

Usage

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)
deriv_n(k, 2)
deriv_n(k, 3)

nabla documentation built on Feb. 11, 2026, 1:06 a.m.