This post references the Riemann-Siegel formula found at here and at here.
I am writing a Java program which implements this formula. I am having trouble with the remainder terms.
The Riemann-Siegel formula is defined by -
$$Z(t) = 2 \sum_{n^2 \, < \,t\,/\,2\pi} n^{-1/2}\cos\big(\theta(t)-t \log (n)\big)+R(t)$$
where $R(t)$ involves a bunch of remainder terms starting with $C_0$.
$$C_0 = \Psi(z) = \frac{\cos \Big(2\pi\left(z^2-z-1/16\right)\Big)}{\cos (2\pi z)}$$
The first remainder term, $C_0$, can be directly calculated by writing the function directly in Java (The $z$ inside the calculation is restricted to $0 \leq z \leq 1$). Terms $C_1$ through $C_4$ create a giant mess since the program must evaluate up to the $12$th derivative of the original $C_0$ term. Is there a functional way around this, most likely involving a series expansion?
This may be a trivial issue to someone who knows more about Taylor Series. Can the Taylor Series approximation be used to evaluate multiple derivatives for $C_0$?
$$\frac{\cos \Big(2\pi\left(z^2-z-1/16\right)\Big)}{\cos (2\pi z)}$$