\section*{Calculation of a function of complex variable by solving
differential equations}

Let us e.g. calculate $\exp(z)$ from the differential equation
$\frac{du}{dt}=u$ with the boundary condition $u(0)=1$. Introducing
the real parameter $s\in[0,1]$ and making a substitution $t=sz$, we get
$u^\prime(s)=zu(s)$, $u(0)=1$, where the prime denotes $\frac{d}{ds}$. To avoid
complex arithmetics we introduce $v=\Re(u), w=\Im(u)$ and get a system
of two real ordinary differential equations (with $z=x+iy$)
\begin{equation}
\left\{\begin{array}{l}
v^\prime(s)=xv(s)-yw(s),\\
w^\prime(s)=xw(s)+yv(s),\\
v(0)=1,\\ w(0)=0,
\end{array}\right. \;,
\end{equation}
the solution to which gives the sought $\exp(z)$: $\Re(\exp(z))=v(1)$,
$\Im(\exp(z))=w(1)$.

This system can be solved with our routines rkdriver/pcdriver.
For larger $z$ one can first use
\begin{eqnarray}
\exp(z_{1}+z_{2})=\exp(z_{1})\exp(z_{2}),\\
\exp(n)=e^{n},\; \exp(i\pi/2)=i.
\end{eqnarray}

\section*{Calculation of a function of complex variable by
integration}

Let us calculate e.g. $\arctan(z)$ using the integral representation
\begin{equation}
\arctan(z)=\int_{0}^{z} {dt\over {1+t^{2}}}.
\end{equation}
The integration path can be taken as a straight line from 0 to $z=x+iy$ as
$t=sz$, where $s\in[0,1]$ is a real parameter,
\begin{equation}
\arctan(z)=z\int_{0}^{1}{ds\over {1+(sz)^2}}.
\end{equation}
one can avoid using complex arithmetics by calculating separately the
real and imaginary parts of the integral with our routine adapt. If
$|z|>1$ one should perhaps instead use
\begin{equation}
\arctan(z)={\pi\over2}-\int_{z}^{\infty} {dt\over{1+t^{2}}}.
\end{equation}
