Function Repository Resource:

ClausenCl

Source Notebook

Evaluate the Clausen function

Contributed by: Enrique Zeleny and Jan Mangaldan

ResourceFunction["ClausenCl"][n,z]

gives the Clausen function Cln(z).

Details

Mathematical function, suitable for both symbolic and numerical manipulation.
The Clausen function is defined as if n is even and if n is odd.
Cln(z) is a periodic function in z with period 2π.
ResourceFunction["ClausenCl"] has branch cut discontinuities in the complex z plane running from 2n π-ⅈ ∞ to 0 and from 0 to 2n π+ⅈ ∞ for integers n.
For certain special arguments, ResourceFunction["ClausenCl"] automatically evaluates to exact values.
ResourceFunction["ClausenCl"] can be evaluated to arbitrary numerical precision.
ResourceFunction["ClausenCl"] automatically threads over lists.

Examples

Basic Examples (2) 

Evaluate numerically:

In[1]:=
ResourceFunction["ClausenCl"][2, 4.7]
Out[1]=

Plot the first few Clausen functions:

In[2]:=
Plot[ResourceFunction["ClausenCl"][Range[4], \[Theta]] // Evaluate, {\[Theta], 0, 2 \[Pi]}]
Out[2]=

Scope (5) 

Evaluate for complex arguments and parameters:

In[3]:=
ResourceFunction["ClausenCl"][7, 0.9 + 0.8 I]
Out[3]=

Evaluate to high precision:

In[4]:=
N[ResourceFunction["ClausenCl"][2, 3], 30]
Out[4]=

The precision of the output tracks the precision of the input:

In[5]:=
ResourceFunction["ClausenCl"][2, 3.0000000000000000000000]
Out[5]=

Simple exact values are generated automatically:

In[6]:=
ResourceFunction["ClausenCl"][2, \[Pi]/2]
Out[6]=
In[7]:=
ResourceFunction["ClausenCl"][3, \[Pi]]
Out[7]=

ClausenCl threads elementwise over lists:

In[8]:=
ResourceFunction["ClausenCl"][5, {0.2, 0.7, 0.9}]
Out[8]=

Parity transformations and periodicity relations are automatically applied:

In[9]:=
ResourceFunction["ClausenCl"][3, -x]
Out[9]=
In[10]:=
ResourceFunction["ClausenCl"][4, -x]
Out[10]=
In[11]:=
ResourceFunction["ClausenCl"][5, x + 4 \[Pi]]
Out[11]=

Applications (1) 

Plots of the Clausen function in the complex plane:

In[12]:=
ComplexPlot[ResourceFunction["ClausenCl"][2, z], {z, 1.5}]
Out[12]=
In[13]:=
Plot3D[Im[ResourceFunction["ClausenCl"][1, x + I y]], {x, -1.5, 1.5}, {y, -1.7, 1.7}, ColorFunction -> "DarkRainbow", Mesh -> 20, MeshFunctions -> (#3 &), PlotPoints -> 30]
Out[13]=

Properties and Relations (4) 

The Clausen function can be expressed in terms of PolyLog:

In[14]:=
Table[ResourceFunction["ClausenCl"][n, z] == If[OddQ[n], (PolyLog[n, E^(I z)] + PolyLog[n, E^(-I z)])/2, (
    PolyLog[n, E^(I z)] - PolyLog[n, E^(-I z)])/(2 I)] /. z -> RandomComplex[WorkingPrecision -> 20], {n, 1, 9}]
Out[14]=

The Clausen function appears in the reflection formula for BarnesG:

In[15]:=
Log[BarnesG[1 + z]/BarnesG[1 - z]] == z Log[\[Pi] Csc[\[Pi] z]] - ResourceFunction["ClausenCl"][2, 2 \[Pi] z]/(2 \[Pi]) /. z -> RandomReal[WorkingPrecision -> 20]
Out[15]=

Verify a relationship between the Clausen function and the inverse tangent integral:

In[16]:=
ResourceFunction["ArcTanIntegral"][2, Tan[u]] == u Log[Tan[u]] + (
   ResourceFunction["ClausenCl"][2, 2 u] + ResourceFunction["ClausenCl"][2, \[Pi] - 2 u])/2 /. u -> RandomReal[WorkingPrecision -> 20]
Out[16]=

Verify the duplication theorem:

In[17]:=
ResourceFunction["ClausenCl"][n + 1, 2 z] == 2^n (ResourceFunction["ClausenCl"][n + 1, z] + (-1)^
      n ResourceFunction["ClausenCl"][n + 1, \[Pi] - z]) /. {n -> 5, z -> RandomReal[WorkingPrecision -> 20]}
Out[17]=

Neat Examples (1) 

Values of the Clausen function at rational multiples of π can be expressed in terms of PolyGamma:

In[18]:=
With[{p = 3, q = 7}, Table[N[ResourceFunction["ClausenCl"][m, (\[Pi] p)/q] == (-1)^
     Binomial[m + 1, 2]/((2 q)^m (m - 1)!) \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(q\)]\(Sin[
\*FractionBox[\(\[Pi]\ p\), \(q\)] j + 
\*FractionBox[\(m\ \[Pi]\), \(2\)]] \((PolyGamma[m - 1, 
\*FractionBox[\(j\), \(2  q\)]] + 
\*SuperscriptBox[\((\(-1\))\), \(p\)] PolyGamma[m - 1, 
\*FractionBox[\(j + q\), \(2  q\)]])\)\)\), 20], {m, 10}]]
Out[18]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.1.0 – 31 August 2021
  • 1.0.0 – 12 February 2019

Source Metadata

Related Resources

License Information