Principle
The theory in the Complex Step Differentiation is to use the relationship:
\[f(x+i\epsilon)=f(x)+i\epsilon f'(x)+O(\epsilon^2)\]
We can get the derivative:
\[f'(x)=imag(\frac{f(x+i\epsilon)}{\epsilon})\]
See Professor Nick Higham's talk on Juliacon 2018.
If you are also interested in Complex Step Differentiation, please see the relating papers: