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

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

# S4 method for class '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))  # 5
#> [1] 5
value(min(x, y))  # 3
#> [1] 3