Accurate derivative information is central to sensitivity analysis and optimization, yet standard finite differences can lose many digits when the step size is small because of subtractive cancellation. Complex-step differentiation largely resolves this issue for first derivatives, but robust second derivatives and mixed partials remain delicate: several practical complex-step variants for
still subtract nearly equal quantities, and quaternion-step rules are often presented as separate constructions. We develop a unified slice-based framework that extracts first and second derivatives from a single evaluation by projecting algebraic coefficients in commutative subalgebras of the complexified quaternions. First, we formulate a directional quaternion-steprule parameterized by an arbitrary unit pure quaternion
u and provide an explicit projection operator that makes the underlying complex slice
transparent; the resulting first-derivative formula is rotation invariant and recovers classical
j-step and planar
-step rules as special cases. Second, we construct a
bicomplex double-step calculus in the commuting imaginary units
and
u and show that one evaluation at
separates derivative information into distinct coefficients, with the
-component equal to
, giving a subtraction-free
approximation of
. For bivariate analytic functions we additionally derive one-shot identities for
,
, and
from
and supply practical extraction identities, step-size guidance for
-scaled coefficients, and branch-consistency diagnostics for non-entire functions. The “cancellation-free” property here refers to avoiding the subtraction of nearly equal
real quantities at the level of the differentiation formula; in floating-point arithmetic, coefficient extraction and the
scaling for second-order quantities still interact with roundoff, and we quantify the resulting stable regimes numerically.
Full article