dual-maxmin: Piecewise max and min for dual numbers

dual-maxminR Documentation

Piecewise max and min for dual numbers

Description

Compares on value and propagates the derivative of the selected branch.

Usage

## S4 method for signature 'dualr'
max(x, ..., na.rm = FALSE)

## S4 method for signature 'dualr'
min(x, ..., na.rm = FALSE)

Arguments

x

A dual number.

...

Additional dual or numeric values.

na.rm

Ignored.

Value

A dual representing the max or min.

Examples

x <- dual_variable(3)
y <- dual_variable(5)
value(max(x, y))
value(min(x, y))


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