TOPICS
Search

Complex Step Differentiation


Complex step differentiation is a method of numerical differentiation that estimates a derivative using a function value at a complex number. Let x be real and let f(z) be analytic near x, with real values on a real neighborhood of x. For sufficiently small real h, its Taylor series gives

 f(x+ih)=sum_(k=0)^infty((ih)^k)/(k!)f^((k))(x),

where i is the imaginary unit. Taking the imaginary part and dividing by h!=0 yields

 (Imf(x+ih))/h=f^'(x)-(h^2)/6f^(''')(x)+O(h^4).

Here O denotes big-O notation. Thus Imf(x+ih)/h estimates f^'(x) with error O(h^2) (Squire and Trapp 1998).

The approximation avoids subtracting nearly equal real function values, which can cause roundoff error in real finite difference formulas. It requires an analytic function with the stated real-valued restriction and numerical evaluation that preserves the small imaginary perturbation. It does not eliminate errors in the function evaluation or underflow.


See also

Derivative, Numerical Differentiation

Explore with Wolfram|Alpha

References

Squire, W. and Trapp, G. "Using Complex Variables to Estimate Derivatives of Real Functions." SIAM Rev. 40, 110-112, 1998. https://doi.org/10.1137/S003614459631241X.

Cite this as:

Weisstein, Eric W. "Complex Step Differentiation." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/ComplexStepDifferentiation.html

Subject classifications