# Dirichlet Beta Function

The Dirichlet Beta function:

Beta(x) = 1 − 3^−x + 5^−x − ... = Sum{k=1, infinity}[(−1)^(k+1)*((2k−1)^−x)], x > 0.

Beta is defined for all values of x.

For example, Beta(1) = 1 − 1/3 + 1/5 − 1/7 + ... = Pi/4 = 7.85398,16339,74483,09615,66...E−1.

Here are some notes from my program XPCalc - Extra Precision Floating-Point Calculator http://www.oocities.org/hjsmithh/download.html#XPCalc :

Beta(x) = Dirichlet Beta function:

Dirichlet Beta function of x > 0 is defined by the infinite series 1 − 1/3^x + 1/5^x − 1/7^x + ... .

For x >= 0.5, Beta(x) is computed by

Beta(x) = 1 − 1/3^x + 1/5^x − ... − 1/(J − 2)^x + 1/(2*(J)^x) + x/(2*(J)^(x+1)) − x*(x+1)*(x+2)/(6*(J)^(x+3)) + ... ,

with the k-th appended term being x*(x+1)*...*(x+k−2)*2^k * (2^k − 1) * B(k) / (2*k!*(J^(k+x−1))). B(k) is a Bernoulli number and J is a large number of the form 4n + 1. This is from "An Atlas Of Functions" by Spanier, J. and Oldham, K. B. 1987, equation 3:3:7.

For x < 0.5, the reflection formula is used: let y = 1−x, then

Beta(x) = (2/Pi)^y * Sin(Pi*y/2) * Gam(y) * Beta(y).

Beta(0) = 1/2. Beta(1) = Pi/4. Beta(2) = G = Catalan's constant = 0.915965594177219015054603514932384110774149374282... . Beta(x) = 0 for all negative odd integers.

```z = Beta(x) // Dirichlet Beta function for x >= 0.5
{
if (x == 0) return 1/2;
if ((x < 0) && (x is odd)) return 0;
sum = 0;              // Beta = Sum ...
n = (int)((decimal-digits desired / 300.0) * digits + 5.0);
if (n < 300) n = 300;
j = 4 * n + 1;
sign = −1;            // (−1)^(k−1)
for (int i = 3; i < j; i += 2)
{
sum += sign * (i ^ −x);
sign = −sign;
}
sum += (j ^ −x) / 2;
twoToK = 4;
d = 4 * (j ^ (x + 1));           // denominator 2*k!*(J^(k+x−1)) with k = 2
xK = x;                          // xK = x + k − 2
xKP = xK;                        // xKP = x * (x+1) * (x+2) * ... * (x+k−2)
GenBernI(limBern);               // generate Bernoulli numbers
for (int k = 2; ; k += 2)
{
term = (twoToK − 1) * twoToK * xKP;
xK++;
xKP *= xK;
if (k > 2)
{
term *= xK;
xK++;
xKP += xK;
}
term *= B(k) / d;          // B(k) = k-th Bernoulli number
sumN = sum + term;         // sumN = new sum
if (sumN == sum) break;
sum = sumN;
twoToK *= 4;               // twoToK = 2^k
d *= j * j * (k+1) * (k+2);
}
sum += 1;
return sum;
}

```
BetaL(X) = Dirichlet beta function for large |X|:

Same as Beta(x) but uses a method that is faster for large |x|. The method comes from the book "Mathematical Constants" by Steven Finch. On page 53 there is a formula for the Dirichlet beta function as a product of primes. See:

BetaL(x) = Prod{p prime, p = 1 mod 4}[p^x/(p^x − 1)] * Prod{ p prime, p = 3 mod 4}[ p^x/(p^x + 1)].

This product is repeated until a factor is equal to 1. If |x| < 100, this converges very slowly, so the normal Beta(x) is used.

For x < 0.5, the reflection formula is used: let y = 1−x, then

BetaL(x) = (2/Pi)^y * Sin(Pi*y/2) * Gam(y) * BetaL(y).

See: Dirichlet Beta Function -- From MathWorld
And: Wolfram Function Evaluation -- LerchPhi (Beta(x) = 2^(−x)*LerchPhi(−1, x, 1/2)

This page accessed times since April 6, 2005.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Wednesday, 27-Feb-08 20:35:40 PST