differentiate_n: Compute a function value and all derivatives up to order n

View source: R/dual-higher.R

differentiate_nR Documentation

Compute a function value and all derivatives up to order n

Description

Evaluates f at a dual variable seeded for order n, returning the function value and all derivatives from 1 to n.

Usage

differentiate_n(f, x, order)

Arguments

f

A function of one numeric argument.

x

A numeric value at which to differentiate.

order

A positive integer: the maximum derivative order.

Value

A named list with components value, d1, d2, ..., d<order>.

Examples

differentiate_n(sin, pi/4, order = 4)

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