ClausenFunctions.clFunction
cl(n, z)

Returns the value of the Clausen function $\operatorname{Cl}_n(z)$ for all integers $n\in\mathbb{Z}$ and arguments $z$ of type Real or Complex. For complex $z\in\mathbb{C}$ this function is defined as

\begin{aligned} \operatorname{Cl}_n(z) &= \frac{i}{2}\left[\operatorname{Li}_n(e^{-iz}) - \operatorname{Li}_n(e^{iz})\right], \qquad \text{for}~n~\text{even}, \\ \operatorname{Cl}_n(z) &= \frac{1}{2}\left[\operatorname{Li}_n(e^{-iz}) + \operatorname{Li}_n(e^{iz})\right], \qquad \text{for}~n~\text{odd}. \end{aligned}

For real $z\in\mathbb{R}$ the function simplifies to

\begin{aligned} \operatorname{Cl}_n(z) &= \Im[\operatorname{Li}_n(e^{iz})] = \sum_{k=1}^\infty \frac{\sin(kz)}{k^n}, \qquad \text{for even}~n>0, \\ \operatorname{Cl}_n(z) &= \Re[\operatorname{Li}_n(e^{iz})] = \sum_{k=1}^\infty \frac{\cos(kz)}{k^n}, \qquad \text{for odd}~n>0. \end{aligned}

Note: $\operatorname{Cl}_1(z)$ is not defined for $z=2k\pi$ with $k\in\mathbb{Z}$.

For $z$ of type Float16, Float32 or Float64 the implementation follows the approach presented in [Jiming Wu, Xiaoping Zhang, Dongjie Liu, "An efficient calculation of the Clausen functions Cl_n(θ)(n >= 2)", Bit Numer Math 50, 193-206 (2010) https://doi.org/10.1007/s10543-009-0246-8].

Author: Alexander Voigt

Example

julia> cl(10, 1.0)
0.8423605391686301

julia> cl(10, big"1")
0.8423605391686302305168624869816554653186479602725762955247227248477087749849797

julia> cl(10, 1.0 + 1.0im)
1.301796548970136 + 0.6333106255561783im

julia> cl(10, big"1" + 1im)
1.301796548970136401486390838171927382622047488046695826621336318796926878116022 + 0.6333106255561785282041229828047700199791464296534659278461150656661132141323808im
ClausenFunctions.cl1Function
cl1(z)

Returns the value of the Clausen function $\operatorname{Cl}_1(z)$ for an argument $z$ of type Real or Complex. This function is defined as

$$$\operatorname{Cl}_1(z) = -\frac{1}{2}\left[\log(1 - e^{iz}) + \log(1 - e^{-iz})\right]$$$

Note: $\operatorname{Cl}_1(z)$ is not defined for $z=2k\pi$ with $k\in\mathbb{Z}$.

Author: Alexander Voigt

Example

julia> cl1(1.0)
0.04201950582536895

julia> cl1(big"1")
0.04201950582536896172579838403790203712453892055703441769956888996856898991572203

julia> cl1(1.0 + 1.0im)
-0.3479608285425303 - 0.7021088550913619im

julia> cl1(big"1" + 1im)
-0.3479608285425304681676697311626225254052481291939705626677618712960309352197459 - 0.7021088550913618982002640571209884840333848751442483836897991093694470903764252im
ClausenFunctions.cl2Method
cl2(x::Real)::Real

Returns the value of the Clausen function $\operatorname{Cl}_2(x)$ for a real angle $x$ of type Real. The Clausen function is defined as

$$$\operatorname{Cl}_2(x) = -\int_0^x \log|2\sin(t/2)| dt$$$

Author: Alexander Voigt

Example

julia> cl2(1.0)
1.0139591323607684
ClausenFunctions.cl3Method
cl3(x::Real)::Real

Returns the value of the Clausen function $\operatorname{Cl}_3(x)$ for a real angle $x$ of type Real. This function is defined as

$$$\operatorname{Cl}_3(x) = \Re[\operatorname{Li}_3(e^{ix})] = \sum_{k=1}^\infty \frac{\cos(kx)}{k^3}$$$

Author: Alexander Voigt

Example

julia> cl3(1.0)
0.44857300728001737
ClausenFunctions.cl4Method
cl4(x::Real)::Real

Returns the value of the Clausen function $\operatorname{Cl}_4(x)$ for a real angle $x$ of type Real. This function is defined as

$$$\operatorname{Cl}_4(x) = \Im[\operatorname{Li}_4(e^{ix})] = \sum_{k=1}^\infty \frac{\sin(kx)}{k^4}$$$

Author: Alexander Voigt

Example

julia> cl4(1.0)
0.8958052386793799
ClausenFunctions.cl5Method
cl5(x::Real)::Real

Returns the value of the Clausen function $\operatorname{Cl}_5(x)$ for a real angle $x$ of type Real. This function is defined as

$$$\operatorname{Cl}_5(x) = \Re[\operatorname{Li}_5(e^{ix})] = \sum_{k=1}^\infty \frac{\cos(kx)}{k^5}$$$

Author: Alexander Voigt

Example

julia> cl5(1.0)
0.5228208076420943
ClausenFunctions.cl6Method
cl6(x::Real)::Real

Returns the value of the Clausen function $\operatorname{Cl}_6(x)$ for a real angle $x$ of type Real. This function is defined as

$$$\operatorname{Cl}_6(x) = \Im[\operatorname{Li}_6(e^{ix})] = \sum_{k=1}^\infty \frac{\sin(kx)}{k^6}$$$

Author: Alexander Voigt

Example

julia> cl6(1.0)
0.855629273183937
ClausenFunctions.slMethod
sl(n, z)

Returns the value of the Glaisher-Clausen function $\operatorname{Sl}_n(z)$ for all integers $n\in\mathbb{Z}$ and arguments $z$ of type Real or Complex. For complex $z\in\mathbb{C}$ this function is defined as

\begin{aligned} \operatorname{Sl}_n(z) &= \frac{1}{2}\left[\operatorname{Li}_n(e^{-iz}) + \operatorname{Li}_n(e^{iz})\right], \qquad \text{for}~n~\text{even}, \\ \operatorname{Sl}_n(z) &= \frac{i}{2}\left[\operatorname{Li}_n(e^{-iz}) - \operatorname{Li}_n(e^{iz})\right], \qquad \text{for}~n~\text{odd}. \end{aligned}

For real $z\in\mathbb{R}$ the function simplifies to

\begin{aligned} \operatorname{Sl}_n(z) &= \Re[\operatorname{Li}_n(e^{iz})] = \sum_{k=1}^\infty \frac{\cos(kz)}{k^n}, \qquad \text{for even}~n>0, \\ \operatorname{Sl}_n(z) &= \Im[\operatorname{Li}_n(e^{iz})] = \sum_{k=1}^\infty \frac{\sin(kz)}{k^n}, \qquad \text{for odd}~n>0. \end{aligned}

Note: We set $\operatorname{Sl}_1(0) = 0$ for consistency with the series expansion.

Author: Alexander Voigt

Example

julia> sl(10, 1.0)
0.5398785706335891

julia> sl(10, big"1")
0.5398785706335893473201701431352733846690266746377581980285682505050227015352517

julia> sl(10, 1.0 + 1.0im)
0.832020890646937 - 0.9921163924162678im

julia> sl(10, big"1" + 1im)
0.832020890646937194384242195240640660735825609698824394209500978844042810286907 - 0.9921163924162683284596904585334878021171116435958891901780686447162617670776108im