Routines for computing special values of L-functions

sage.quadratic_forms.special_values.QuadraticBernoulliNumber(k, d)

Compute k-th Bernoulli number for the primitive quadratic character associated to \chi(x) = \left(\frac{d}{x}\right).

Reference: Iwasawa’s “Lectures on p-adic L-functions”, pp7-16.

EXAMPLES:

sage: ## Makes a set of odd fund discriminants < -3
sage: Fund_odd_test_set = [D  for D in range(-163, -3, 4)  if is_fundamental_discriminant(D)]  

sage: ## In general, we have B_{1, \chi_d} = -2h/w  for odd fund disc < 0
sage: for D in Fund_odd_test_set: 
...      if len(BinaryQF_reduced_representatives(D)) != -QuadraticBernoulliNumber(1, D): 
...          print "Oops!  There is an error at D = ", D 
sage.quadratic_forms.special_values.gamma__exact(n)

Evaluates the exact value of the gamma function at an integer or half-integer argument.

EXAMPLES:

sage: gamma__exact(4)
6
sage: gamma__exact(3)
2
sage: gamma__exact(2)
1
sage: gamma__exact(1)
1

sage: gamma__exact(1/2)
sqrt(pi)
sage: gamma__exact(3/2)
1/2*sqrt(pi)
sage: gamma__exact(5/2)
3/4*sqrt(pi)
sage: gamma__exact(7/2)
15/8*sqrt(pi)

sage: gamma__exact(-1/2)
-2*sqrt(pi)
sage: gamma__exact(-3/2)
4/3*sqrt(pi)
sage: gamma__exact(-5/2)
-8/15*sqrt(pi)
sage: gamma__exact(-7/2)
16/105*sqrt(pi)
sage.quadratic_forms.special_values.quadratic_L_function__exact(n, d)

Returns the exact value of a quadratic twist of the Riemann Zeta function by \chi_d(x) = \left(\frac{d}{x}\right).

References:

  • Iwasawa’s “Lectures on p-adic L-functions”, p16-17, “Special values of L(1-n, \chi) and L(n, \chi)
  • Ireland and Rosen’s “A Classical Introduction to Modern Number Theory”
  • Washington’s “Cyclotomic Fields”

EXAMPLES:

sage: bool(quadratic_L_function__exact(1, -4) == pi/4)
True
sage.quadratic_forms.special_values.quadratic_L_function__numerical(n, d, num_terms=1000)

Evaluate the Dirichlet L-function (for quadratic character) numerically (in a very naive way).

EXAMPLES:

sage:  ## Test several values for a given character
sage: RR = RealField(100)
sage: for i in range(5):
...       print "L(" + str(1+2*i) + ", (-4/.)): ", RR(quadratic_L_function__exact(1+2*i, -4)) - quadratic_L_function__numerical(RR(1+2*i),-4, 10000)
L(1, (-4/.)):  0.000049999999500000024999996962707
L(3, (-4/.)):  4.99999970000003...e-13
L(5, (-4/.)):  4.99999922759382...e-21
L(7, (-4/.)):  ...e-29
L(9, (-4/.)):  ...e-29

sage: ## Testing the accuracy of the negative special values
sage: ## ---- THIS FAILS SINCE THE DIRICHLET SERIES DOESN'T CONVERGE HERE! ----

sage: ## Test several characters agree with the exact value, to a given accuracy.
sage: for d in range(-20,0):
...       if abs(RR(quadratic_L_function__numerical(1, d, 10000) - quadratic_L_function__exact(1, d))) > 0.001:
...           print "Oops!  We have a problem at d = ", d, "    exact = ", RR(quadratic_L_function__exact(1, d)), "    numerical = ", RR(quadratic_L_function__numerical(1, d))  
...           
sage.quadratic_forms.special_values.zeta__exact(n)

Returns the exact value of the Riemann Zeta function

References:

  • Iwasawa’s “Lectures on p-adic L-functions”, p13, “Special value of \zeta(2k)
  • Ireland and Rosen’s “A Classical Introduction to Modern Number Theory”
  • Washington’s “Cyclotomic Fields”

EXAMPLES:

sage: ## Testing the accuracy of the negative special values
sage: RR = RealField(100)
sage: for i in range(1,10):
...       print "zeta(" + str(1-2*i) + "): ", RR(zeta__exact(1-2*i)) - zeta(RR(1-2*i))
zeta(-1):  0.00000000000000000000000000000
zeta(-3):  0.00000000000000000000000000000
zeta(-5):  0.00000000000000000000000000000
zeta(-7):  0.00000000000000000000000000000
zeta(-9):  0.00000000000000000000000000000
zeta(-11):  0.00000000000000000000000000000
zeta(-13):  0.00000000000000000000000000000
zeta(-15):  0.00000000000000000000000000000
zeta(-17):  0.00000000000000000000000000000

sage: RR = RealField(100)
sage: for i in range(1,10):
...       print "zeta(" + str(1-2*i) + "): ", RR(zeta__exact(1-2*i)) - zeta(RR(1-2*i))
zeta(-1):  0.00000000000000000000000000000
zeta(-3):  0.00000000000000000000000000000
zeta(-5):  0.00000000000000000000000000000
zeta(-7):  0.00000000000000000000000000000
zeta(-9):  0.00000000000000000000000000000
zeta(-11):  0.00000000000000000000000000000
zeta(-13):  0.00000000000000000000000000000
zeta(-15):  0.00000000000000000000000000000
zeta(-17):  0.00000000000000000000000000000

Previous topic

Creating A Random Quadratic Form

Next topic

Optimised Cython code for counting congruence solutions

This Page