2017年6月24日土曜日

170624

Ruby


Borcherds Products(1)

R. E. Borcherds, Automorphic forms on O_{s+2,2}(R)^{+} and generalized Kac-Moody algebras
に載っている
1 - 504*q - 16632*q^2 - 122976*q^3 - ...
= (1 - q)^504 * (1 - q^2)^143388 * (1 - q^3)^51180024 * ...
を両辺log をとることで確認してみた。
他にE_2, E_4, E_8, E_12 の場合も確認してみた。

require 'prime'

def power0(a, n)
  return 1 if n == 0
  k = power0(a, n >> 1)
  k *= k
  return k if n & 1 == 0
  return k * a
end

# x > 0
def sigma(x, i)
  sum = 1
  pq = i.prime_division
  pq.each{|a, n| sum *= (power0(a, (n + 1) * x) - 1) / (power0(a, x) - 1)}
  sum
end

def bernoulli(n)
  ary = []
  a = []
  (0..n).each{|i|
    a << 1r / (i + 1)
    i.downto(1){|j| a[j - 1] = j * (a[j - 1] - a[j])}
    ary << a[0] # Bn = a[0]
  }
  ary
end

def E0_2k(k, n)
  a = -4 * k / bernoulli(2 * k)[-1]
  [1] + (1..n).map{|i| a * sigma(2 * k - 1, i)}
end

# m次以下を取り出す
def mul(f_ary, b_ary, m)
  s1, s2 = f_ary.size, b_ary.size
  ary = Array.new(s1 + s2 - 1, 0)
  (0..s1 - 1).each{|i|
    (0..s2 - 1).each{|j|
      ary[i + j] += f_ary[i] * b_ary[j]
    }
  }
  ary[0..m]
end

def S(c_ary, x_ary, n)
  ary = Array.new(n + 1, 0)
  tq = x_ary
  tqn = [1] + Array.new(n, 0)
  (0..c_ary.size - 1).each{|i|
    (0..n).each{|j|
      ary[j] += c_ary[i] * tqn[j]
    }
    tqn = mul(tqn, tq, n)
  }
  ary
end

def I(ary, n)
  a = [1]
  (0..n - 1).each{|i| a << -(0..i).inject(0){|s, j| s + ary[1 + i - j] * a[j]}}
  a
end

def A008683(n)
  ary = n.prime_division
  return (-1) ** (ary.size % 2) if ary.all?{|i| i[1] == 1}
  0
end

def A(k, m, n)
  a = I(E0_2k(k, n), n)
  b = E0_2k(k + 1, n)
  # E_{2k+2}/E_{2k}を出力
  p c = mul(a, b, n)
  m_ary = [0] + (1..n).map{|i| A008683(i)}
  ary = []
  (1..n).each{|i|
    s = 0
    (1..i).each{|j|
      s += m_ary[i / j] * c[j] if i % j == 0
    }
    ary << m + m * s / (24 * i)
  }
  ary
end

# c_ary は1次から
def T(c_ary, n)
  ary = Array.new(n + 1, 0)
  tq = [0] + (1..n).map{|i| -1r / i}
  (1..c_ary.size).each{|i|
    tqn = Array.new(n + 1, 0)
    (0..n / i).each{|j| tqn[i * j] = tq[j]}
    (0..n).each{|j|
      ary[j] += c_ary[i - 1] * tqn[j]
    }
  }
  ary
end

# 二通りで求め、一致することを確認
def f(k, m, n)
  p 2 * k
  x_ary = E0_2k(k, n)
  x_ary[0] = 0
  p s_ary = S(@c_ary, x_ary, n)
  p t_ary = T(A(k, m, n), n)
  p s_ary == t_ary
end

n = 10
@c_ary = [0] + (1..n).map{|i| (-1) ** (i % 2 + 1) * 1r / i}
f(1, 2, n)
f(2, 8, n)
f(3, 12, n)
f(4, 16, n)
f(6, 24, n)

出力結果
2
[(0/1), (-24/1), (-360/1), (-6432/1), (-129480/1), (-13893264/5), (-62117856/1), (-9998360256/7), (-33527414664/1), (-799482199416/1), (-19302455707056/1)]
[1, (264/1), (8568/1), (231456/1), (6214872/1), (166719024/1), (4472485344/1), (119980322880/1), (3218631807384/1), (86344077536616/1), (2316294684846288/1)]
[(0/1), (-24/1), (-360/1), (-6432/1), (-129480/1), (-13893264/5), (-62117856/1), (-9998360256/7), (-33527414664/1), (-799482199416/1), (-19302455707056/1)]
true
4
[(0/1), (240/1), (-26640/1), (4096320/1), (-708952080/1), (130880766240/1), (-25168871459520/1), (34848505552897920/7), (-1005225129672310800/1), (206195878414964053680/1), (-42824436295980177980640/1)]
[1, (-744/1), (159768/1), (-36866976/1), (8507424792/1), (-1963211493744/1), (453039686271072/1), (-104545516658693952/1), (24125403112135458840/1), (-5567288717204029449672/1), (1284733088879405339418768/1)]
[(0/1), (240/1), (-26640/1), (4096320/1), (-708952080/1), (130880766240/1), (-25168871459520/1), (34848505552897920/7), (-1005225129672310800/1), (206195878414964053680/1), (-42824436295980177980640/1)]
true
6
[(0/1), (-504/1), (-143640/1), (-51180192/1), (-20556650520/1), (-44031499226064/5), (-3929750687018016/1), (-1803727445909594688/1), (-845145871858011095064/1), (-402283166289266889884376/1), (-193877350835491674934518096/1)]
[1, (984/1), (574488/1), (307081056/1), (164453203992/1), (88062998451984/1), (47157008244215904/1), (25252184242734325440/1), (13522333949728177520664/1), (7241096993206804017918456/1), (3877547016709833498690361488/1)]
[(0/1), (-504/1), (-143640/1), (-51180192/1), (-20556650520/1), (-44031499226064/5), (-3929750687018016/1), (-1803727445909594688/1), (-845145871858011095064/1), (-402283166289266889884376/1), (-193877350835491674934518096/1)]
true
8
[(0/1), (480/1), (-53280/1), (8192640/1), (-1417904160/1), (261761532480/1), (-50337742919040/1), (69697011105795840/7), (-2010450259344621600/1), (412391756829928107360/1), (-85648872591960355961280/1)]
[1, (-744/1), (159768/1), (-36866976/1), (8507424792/1), (-1963211493744/1), (453039686271072/1), (-104545516658693952/1), (24125403112135458840/1), (-5567288717204029449672/1), (1284733088879405339418768/1)]
[(0/1), (480/1), (-53280/1), (8192640/1), (-1417904160/1), (261761532480/1), (-50337742919040/1), (69697011105795840/7), (-2010450259344621600/1), (412391756829928107360/1), (-85648872591960355961280/1)]
true
12
[(0/1), (65520/691), (90620646480/477481), (-442346531739840/329939371), (-4181632252548250958640/227988105361), (42458488606933509112722720/157539780804451), (254774946968486556568732840559040/108859988535875641), (-3880639008647134201555086919223041920/75222252078290067931), (-17460929864122236834882554512696144803620400/51978576186098436940321), (354829247093611920019527363838479842967750379440/35917196144594019925761811), (1276094183659938234585318200922032531674640614094890080/24818782535914467768701411401)]
[1, (-82104/691), (-181275671592/477481), (1327007921039904/329939371), (16726528971891002133912/227988105361), (-212292443057353273999454544/157539780804451), (-1528649681810950691089095375538848/108859988535875641), (27164473060529924968213209402868250688/75222252078290067931), (139687438912977894660348148674573721130447640/51978576186098436940321), (-3193463223842507280186952439743431920926591099992/35917196144594019925761811), (-12760941836599382345853192730934380831796482219958626032/24818782535914467768701411401)]
[(0/1), (65520/691), (90620646480/477481), (-442346531739840/329939371), (-4181632252548250958640/227988105361), (42458488606933509112722720/157539780804451), (254774946968486556568732840559040/108859988535875641), (-3880639008647134201555086919223041920/75222252078290067931), (-17460929864122236834882554512696144803620400/51978576186098436940321), (354829247093611920019527363838479842967750379440/35917196144594019925761811), (1276094183659938234585318200922032531674640614094890080/24818782535914467768701411401)]
true

0 件のコメント:

コメントを投稿