Prev Next Index-> contents reference index search external Up-> CppComplexStep Theory CppComplexStep-> Theory ExampleFun CentralStep ComplexStep FirstOrder SecondOrder Makefile Theory Headings

Theory of Complex Step Method
Let $\R$ and $\C$ denote the real and complex numbers respectively. Suppose that $Z$ is an open subset of $\C$ and the functions $f : Z \rightarrow \C$ is complex differentiable (analytic). It follows that for each $z \in Z$ there is a $\delta > 0$ such that if $|h| \leq \delta$, $$\begin{array}{rcl} f(z + h) & = & f(z) + \sum_{j=1}^\infty f^{(j)} (z) h^j / j ! \end{array}$$ Setting $h = {\rm i} \delta$ we have $$\begin{array}{rcl} f( z + {\rm i} \delta ) & = & f(z) + \sum_{j=1}^\infty {\rm i}^j f^{(j)} (z) \delta^j / j ! \end{array}$$ We now further suppose that for all $x \in \R$, $f(x) \in \R$. It follows that if $x \in \R$ and $j$ is any non-negative integer, $f^{(j)} (x) \in \R$. Hence the imaginary part of $f( x + {\rm i} \delta )$ satisfies $$\begin{array}{rcl} {\rm Imag} [ f( x + {\rm i} \delta ) ] & = & f^{(1)} (x) \delta^1 / 1 ! - f^{(3)} (x) \delta^3 / 3 ! + f^{(5)} (x) \delta^5 / 5 ! - \cdots \\ \frac{ {\rm Imag} [ f( x + {\rm i} \delta ) ] }{ \delta } & = & f^{(1)} (x) - f^{(3)} (x) \delta^2 / 3 ! + f^{(5)} (x) \delta^4 / 5 ! - \cdots \end{array}$$ Suppose that there is a function $\tilde{f} (z)$ that we can evaluate such that for all $z \in Z$ $$| \; {\rm Imag} [ \tilde{f} (z) - f(z) ] \; | \leq | \; \varepsilon {\rm Imag} [ f(z) ] \; |$$ It follows that $$\begin{array}{rcl} \left| \frac{ {\rm Imag} [ \tilde{f} ( x + {\rm i} \delta ) ] }{ \delta } - f^{(1)} (x) \right| & \leq & \varepsilon \left| \frac{ {\rm Imag} [ \tilde{f} ( x + {\rm i} \delta ) ] }{ \delta } \right| \\ & + & \delta^2 | f^{(3)} (x) | / 3 ! + \delta^4 | f^{(5)} (x)| / 5 ! - \cdots \\ & \leq & \frac{ \varepsilon}{1 - \varepsilon} | f^{(1)} (x) | \\ & + & \delta^2 | f^{(3)} (x) | / 3 ! + \delta^4 | f^{(5)} (x)| / 5 ! - \cdots \\ \end{array}$$ Since we can make $\delta$ arbitrarily small, we can effectively evaluate the derivative of $f$ with nearly the same relative accuracy as we can evaluate the imaginary part of $f$.
Input File: Theory.omh