jupyter | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
黒木玄
2018-08-12~2019-04-03, 2020-04-25
- Copyright 2018,2019,2020 Gen Kuroki
- License: MIT https://opensource.org/licenses/MIT
- Repository: https://github.com/genkuroki/Calculus
このファイルは次の場所できれいに閲覧できる:
このノートの元ネタは次のリンク先の式(26)以降の解説である:
- Terence Tao, The Euler-Maclaurin formula, Bernoulli numbers, the zeta function, and real-variable analytic continuation, What's new, 2010-04-10
自分のパソコンにJulia言語をインストールしたい場合には
を参照せよ. 前者は古く, 後者の方が新しい.
$ \newcommand\eps{\varepsilon} \newcommand\ds{\displaystyle} \newcommand\Z{{\mathbb Z}} \newcommand\R{{\mathbb R}} \newcommand\C{{\mathbb C}} \newcommand\QED{\text{□}} \newcommand\root{\sqrt} \newcommand\bra{\langle} \newcommand\ket{\rangle} \newcommand\d{\partial} \newcommand\sech{\operatorname{sech}} \newcommand\cosec{\operatorname{cosec}} \newcommand\sign{\operatorname{sign}} \newcommand\real{\operatorname{Re}} \newcommand\imag{\operatorname{Im}} $
using Base.MathConstants
using Base64
using Printf
using Statistics
const e = ℯ
endof(a) = lastindex(a)
linspace(start, stop, length) = range(start, stop, length=length)
using Plots
gr(); ENV["PLOTS_TEST"] = "true"
gr(bglegend=RGBA(1.0, 1.0, 1.0, 0.5))
#clibrary(:colorcet)
clibrary(:misc)
function pngplot(P...; kwargs...)
sleep(0.1)
pngfile = tempname() * ".png"
savefig(plot(P...; kwargs...), pngfile)
showimg("image/png", pngfile)
end
pngplot(; kwargs...) = pngplot(plot!(; kwargs...))
showimg(mime, fn) = open(fn) do f
base64 = base64encode(f)
display("text/html", """<img src="data:$mime;base64,$base64">""")
end
using SymPy
#sympy.init_printing(order="lex") # default
#sympy.init_printing(order="rev-lex")
using SpecialFunctions
using QuadGK
using LaTeXStrings
using Primes
ENV["LINES"] = 100
using HTTP
以下, 収束性の詳細のこだわらずにラフに説明する.
函数
を
さらに右辺の積分因子は
これより,
例:
でガンマ函数
例:
で
例:
となり,
例:
でかつ右辺の積分因子
eta(x) = exp(-x^2)
x = symbols("x", real=true)
s = symbols("s", positive=true)
integrate(eta(x)*x^(s-1), (x,0,oo))
eta(x,m) = exp(-x^m)
x = symbols("x", real=true)
s = symbols("s", positive=true)
m = symbols("m", positive=true)
integrate(eta(x,m)*x^(s-1), (x,0,oo))
Fourier変換とその逆変換の理論より,
すなわち
したがって,
さらに,
右辺を
注意:
補足: 以上の状況のもとで,
逆Mellin変換表示された函数についてこの議論はよく使われる.
は
とおく. これを Dirichlet級数
カットオフ函数
十分大きな
注意:
より,
と留数定理より,
このように, 滑らかなカットオフは
例えば
例えば,
# 実軸上のプロット
eta(x) = exp(-x^2)
H(s) = gamma(s/2)/2
CutoffZeta(s; N=30, L=10^5) = (ss = float(s); sum(n-> n^(-ss)*eta(n/N), 1:L))
DivergentTerm(s; N=30) = (ss = float(s); H(1-ss)*N^(1-ss))
CutoffZeta0(s; N=30, L=10^5) = CutoffZeta(s; N=N, L=L) - DivergentTerm(s; N=N)
PP = []
for s in [-6.2:0.1:-1.6, -2.0:0.05:0.95, 1.3:0.07:4.0, 3.8:0.07:10]
P = plot(title="N = 30", titlefontsize=10, xlabel="s")
plot!(s, zeta.(s), label="\$\\zeta(s)\$", lw=1.5)
plot!(s, CutoffZeta0.(s), label="\$\\textstyle\\sum\\,n^{-s}\\eta(n/N) - H(1-s)N^{1-s}\$", ls=:dash, lw=1.5)
push!(PP, P)
end
plot(PP[1:2]..., size=(720, 260), legend=:bottomleft)
plot(PP[3:4]..., size=(720, 260), legend=:topright)
# ζ(0) = "1+1+1+…" = -1/2
Ns = 0.1:0.01:1.2
y = (N->CutoffZeta0(0.0, N=N)).(Ns)
plot(size=(350,200), xlabel="N", legendfontsize=10)
plot!(Ns, y, label="\$\\textstyle\\sum\\,\\eta(n/N) - H(1)N\$")
plot!(Ns, zeta(0.0)*fill(1,size(Ns)), label="\$\\zeta(0) = -1/2\$", ls=:dash)
plot!(ylims=(-0.55,-0.05))
# ζ(-1) = "1+2+3+…" = -1/12
Ns = 0.1:0.01:3.0
y = (N->CutoffZeta0(-1.0, N=N)).(Ns)
P1 = plot(size=(350,200), xlabel="N", legendfontsize=10)
plot!(Ns, y, label="\$\\textstyle\\sum\\,n\\eta(n/N) - H(2)N^2\$")
plot!(Ns, zeta(-1.0)*fill(1,size(Ns)), label="\$\\zeta(-1) = -1/12\$", ls=:dash)
plot!(ylims=(-0.13, 0))
# ζ(-2) = "1^2+2^2+3^2+…" = 0
Ns = 0.1:0.01:1.65
y = (N->CutoffZeta0(-2.0, N=N)).(Ns)
P1 = plot(size=(350,200), xlabel="N", legend=:bottomright, legendfontsize=8)
plot!(Ns, y, label="\$\\textstyle\\sum\\,n^2\\eta(n/N) - H(3)N^3\$")
plot!(Ns, zeta(-2.0)*fill(1,size(Ns)), label="\$\\zeta(-2) = 0\$", ls=:dash)
plot!(ylims=(-0.05, 0.002))
# ζ(-3) = "1^3+2^3+3^3+…" = 1/120
Ns = 0.1:0.01:4
y = (N->CutoffZeta0(-3.0, N=N)).(Ns)
P1 = plot(size=(350,200), xlabel="N", legendfontsize=10)
plot!(Ns, y, label="\$\\textstyle\\sum\\,n^3\\eta(n/N) - H(4)N^4\$")
plot!(Ns, zeta(-3.0)*fill(1,size(Ns)), label="\$\\zeta(-3) = 1/120\$", ls=:dash)
plot!(ylims=(-0.016, 0.023), legend=:bottomright)
# critical line 上のプロット
#pyplot()
t = 0.0:0.2:50.0
s = 0.5 .+ im .* t
@time z = CutoffZeta.(s)
w = z .- DivergentTerm.(s)
P = plot(size=(500, 300))
plot!(legend=:topright, xlabel="t")
plot!(title="s = 0.5 + it, N = 30", titlefontsize=10, legendfontsize=10)
plot!(t, abs.(zeta.(s)), label="\$\\left|\\zeta(s)\\right|\$", lw=1.5)
plot!(t, abs.(z), label="\$\\textstyle\\left|\\sum n^{-s}\\eta(n/N)\\right|\$", ls=:dashdot, lw=1.5)
plot!(t, abs.(w), label="\$\\textstyle\\left|\\sum n^{-s}\\eta(n/N) - H(1-s)N^{1-s}\\right|\$", ls=:dash, lw=1.5)
交代Drichlet級数
と定める(2つ目の等号を自分で確認してみよ). たとえば,
より,
が成立している. この場合には
# 実軸上のプロット
Z(s) = (ss = float(s); (1 - 2^(1-ss)) * zeta(ss))
eta(x) = exp(-x^2)
H(s) = gamma(s/2)/2
CutoffZ(s; N=50, L=10^5) = (ss = float(s); sum(n->(-1)^(n-1)*n^(-ss)*eta(n/N), 1:L))
PP = []
for s in [-6.2:0.1:-1.6, -2.0:0.05:0.95, 1.3:0.07:4.0, 3.8:0.07:10]
y = Z.(s)
ymax, ymin = maximum(y), minimum(y)
P = plot(title="N = 50", titlefontsize=10, xlabel="s", legend=true, legendfontsize=8)
plot!(s, Z.(s), label="\$\\textstyle Z(s) = \\hbox{ana. conti. of}\\; \\sum (-1)^{n-1}n^{-s}\$",
lw=1.5, ylim=(ymin, ymax+0.55*(ymax-ymin)))
plot!(s, CutoffZ.(s), label="\$\\textstyle\\sum\\,(-1)^{n-1}n^{-s}\\exp(-n^2/N^2)\$", ls=:dash, lw=1.5)
push!(PP, P)
end
plot(PP[1:2]..., size=(800, 320))
plot(PP[3:4]..., size=(800, 320))
# Z(0) = "1-1+1-1+…" = 1/2
Ns = 0.1:0.01:2.0
y = (N->CutoffZ(0, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}\\exp(-n^2/N^2)\$")
plot!(Ns, Z(0)*fill(1,size(Ns)), label="\$Z(0) = 1/2\$", ls=:dash)
plot!(ylim=(-0.05, 0.55), legend=:bottomright)
# Z(-1) = "1-2+3-4+…" = 1/4
Ns = 0.1:0.01:4.0
y = (N->CutoffZ(-1, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n\\,\\exp(-n^2/N^2)\$")
plot!(Ns, Z(-1)*fill(1,size(Ns)), label="\$Z(-1) = 1/4\$", ls=:dash)
plot!(legend=:bottomright)
# Z(-2) = "1-4+9-16+…" = 0
Ns = 0.1:0.01:4
y = (N->CutoffZ(-2, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n^2\\exp(-n^2/N^2)\$")
plot!(Ns, Z(-2)*fill(1,size(Ns)), label="\$Z(-2) = 0\$", ls=:dash)
plot!(ylim=(-0.05, 0.35))
# Z(-3) = "1-8+27-64+…" = -1/8
Ns = 0.1:0.01:4.0
y = (N->CutoffZ(-3, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n^3\\exp(-n^2/N^2)\$")
plot!(Ns, Z(-3)*fill(1,size(Ns)), label="\$Z(-3) = -1/8\$", ls=:dash)
# critical line 上のプロット
t = 0.0:0.1:50.0
s = 0.5 .+ im .* t
@time z = CutoffZ.(s)
P = plot(size=(500, 300))
plot!(legend=:topright, xlabel="t")
plot!(title="s = 0.5 + it, N = 30", titlefontsize=10)
plot!(t, abs.(Z.(s)), label="\$\\left|Z(s)\\right|=\\left|(1-2^{1-s})\\zeta(s)\\right|\$")
plot!(t, abs.(z), label="\$\\textstyle\\left|\\sum (-1)^{n-1}n^{-s}\\exp(-n^2/N^2)\\right|\$", ls=:dashdot)
plot!(ylim=(-0.1, 6.2), legendfontsize=10)
カットオフ函数が
となる. ゆえに
はAbel和が
# 実軸上のプロット
Z(s) = (ss = float(s); (1 - 2^(1-ss)) * zeta(ss))
eta(x) = exp(-x)
H(s) = gamma(s)
CutoffZ(s; N=200, L=10^5) = (ss = float(s); sum(n->(-1)^(n-1)*n^(-ss)*eta(n/N), 1:L))
PP = []
for (s, N) in [(-6.2:0.1:-1.6, 50), (-2.0:0.05:0.95, 100), (1.3:0.07:4.0, 500), (3.8:0.07:10, 1000)]
P = plot(title="N = $N", titlefontsize=10, xlabel="s")
y = Z.(s)
ymax, ymin = maximum(y), minimum(y)
z = CutoffZ.(s, N=N)
zmax, zmin = maximum(z), minimum(z)
yzmax, yzmin = max(ymax, zmax), min(ymin, zmin)
plot!(s, y, label="\$\\textstyle Z(s) = \\hbox{ana. conti. of}\\; \\sum (-1)^{n-1}n^{-s}\$", lw=1.5)
plot!(s, z, label="\$\\textstyle\\sum\\,(-1)^{n-1}n^{-s}\\exp(-n/N)\$", ls=:dash, lw=1.5)
plot!(ylim=(yzmin, yzmax + 0.5*(yzmax-yzmin)))
push!(PP, P)
end
plot(PP[1:2]..., size=(800, 320), legend=:topleft)
plot(PP[3:4]..., size=(800, 320), legend=:topleft)
# Z(0) = "1-1+1-1+…" = 1/2
Ns = 0.1:0.1:20.0
y = (N->CutoffZ(0, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}\\exp(-n/N)\$")
plot!(Ns, Z(0)*fill(1,size(Ns)), label="\$Z(0) = 1/2\$", ls=:dash)
plot!(ylim=(-0.05, 0.55), legend=:bottomright)
# Z(-1) = "1-2+3-4+…" = 1/4
Ns = 0.1:0.1:5.0
y = (N->CutoffZ(-1, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n\\,\\exp(-n/N)\$")
plot!(Ns, Z(-1)*fill(1,size(Ns)), label="\$Z(-1) = 1/4\$", ls=:dash)
plot!(ylim=(-0.025, 0.275), legend=:bottomright)
# Z(-2) = "1-4+9-16+…" = 0
Ns = 0.1:0.1:50.0
y = (N->CutoffZ(-2, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n^2\\exp(-n/N)\$")
plot!(Ns, Z(-2)*fill(1,size(Ns)), label="\$Z(-2) = 0\$", ls=:dash)
plot!(ylim=(-0.01, 0.11))
# Z(-3) = "1-8+27-64+…" = -1/8
Ns = 0.1:0.01:8.0
y = (N->CutoffZ(-3, N=N)).(Ns)
plot(size=(350,200), xlabel="N")
plot!(Ns, y, label="\$\\textstyle\\sum\\,(-1)^{n-1}n^3\\exp(-n/N)\$")
plot!(Ns, Z(-3)*fill(1,size(Ns)), label="\$Z(-3) = -1/8\$", ls=:dash)
# critical line 上のプロット
t = 0.0:0.1:50.0
s = 0.5 .+ im .* t
@time z = CutoffZ.(s)
P = plot(size=(500, 300))
plot!(legend=:topright, xlabel="t")
plot!(title="s = 0.5 + it, N = 200", titlefontsize=10)
plot!(t, abs.(Z.(s)), label="\$\\left|Z(s)\\right|=\\left|(1-2^{1-s})\\zeta(s)\\right|\$", lw=1.5)
plot!(t, abs.(z), label="\$\\textstyle\\left|\\sum (-1)^{n-1}n^{-s}\\exp(-n/N)\\right|\$", ls=:dashdot, lw=1.5)
plot!(ylim=(-0.1, 6.2), legendfontsize=10)
とLaurent展開される.
特に
すなわち, 左辺から発散項を除いて残る定数項はカットオフ函数
であることがよく知られている. 以上の内容は本質的に階乗に関するStirlingの近似公式であるとも考えられる.
H(s) = gamma(s/2)/2
s = symbols("s")
diff(H(s), s) |> display
H1(s) = gamma(s/2)*digamma(s/2)/4
H1(Sym(1)) |> display
@show H1(1);
eta(x) = exp(-x^2)
CutoffLogSum(N; L=10^6) = sum(n->log(n)*eta(n/N), 1:L)
ApproxSum(N) = log(√(2π)) + H(1)*N*log(N) + H1(1)*N
[(N, CutoffLogSum(N), ApproxSum(N)) for N in 1:10] |> display
PP = []
for Ns in [1:10, 1:100]
P = plot(legend=:topleft, xlabel="N")
y = CutoffLogSum.(Ns)
ymin, ymax = extrema(y)
plot!(Ns, y, label="\$\\textstyle\\sum\\log(n)\\eta(n/N)\$", lw=1.5)
plot!(Ns, ApproxSum.(Ns), label="\$\\log(\\sqrt{2\\pi}) + H(1)N\\log N + H'(1)N\$", ls=:dash, lw=1.5)
plot!(ylims=(ymin-0.05*(ymax-ymin), ymax+0.5*(ymax-ymin)), legendfontsize=9)
push!(PP, P)
end
plot(PP..., size=(800,300))
を持つ. ここで
より
ここで
ゆえに
より,
ここで,
# von Mangoldt 函数 Λ(n) のカットオフを入れた和の計算
eta(x) = exp(-x^2)
Eta(x) = gamma(x/2)/2
function vonMangoldtCutoffSum(N; L=10^6)
c = 0.0
for p in primes(L)
for k in 1:floor(Int,log(p,L))
c += log(p) * eta(p^k/N)
end
end
c
end
ApproximateCutoffSum(N) = -log(2π) + Eta(1)*N
@show log(2π)
@show Eta(1)
[(N, vonMangoldtCutoffSum(N), ApproximateCutoffSum(N)) for N in 1:10] |> display
PP = []
for Ns in [1:10, 1:100]
P = plot(legend=:topleft, xlabel="N")
y1 = vonMangoldtCutoffSum.(Ns)
y2 = ApproximateCutoffSum.(Ns)
ymin, ymax = extrema([y1;y2])
plot!(Ns, y1, label="\$\\textstyle\\sum\\,\\Lambda(n)\\eta(n/N)\$", lw=1.5)
plot!(Ns, y2, label="\$-\\log(2\\pi)+H(1)N\$", ls=:dash, lw=1.5)
plot!(ylims=(ymin-0.05*(ymax-ymin), ymax+0.3*(ymax-ymin)), legendfontsize=9)
push!(PP, P)
end
plot(PP..., size=(800,300))
注意:
と定め,
が成立することがよく知られている(von Mangoldtの明示公式). こちらの明示公式の場合には
における
が成立することが知られている.
# ψ(x) = Σ_{n≦x} Λ(n) と -log(2π) + x をプロットして比較
function psi(x)
c = 0.0
for p in primes(floor(Int,x))
for k in 1:floor(Int,log(p,x))
c += log(p)
end
end
c
end
approxpsi(x) = -log(2π) + x
[(N, psi(N), approxpsi(N)) for N in 1:10] |> display
PP = []
for x in [1:0.05:12, 1:0.5:120]
P = plot(legend=:topleft, xlabel="x")
plot!(x, psi.(x), label="\$\\textstyle\\psi(x)=\\sum\\nolimits_{n\\le x}\\,\\Lambda(n)\$", lw=1.5)
plot!(x, approxpsi.(x), label="\$-\\log(2\\pi)+x\$", ls=:dash, lw=1.5)
push!(PP, P)
end
plot(PP..., size=(800,300))
注意:
http://www.dtc.umn.edu/~odlyzko/zeta_tables/index.html にRiemannのゼータ函数の非自明な零点の虚部のリストが置いてある.
それを用いて, 虚部が
res = HTTP.get("http://www.dtc.umn.edu/~odlyzko/zeta_tables/zeros1",
readtimeout=60, retry=true, retries=20)
zetazeros = parse.(Float64, split(String(res.body), "\n")[1:end-1])
zetazeros[1:10]
# Nzeros(T) = N(T) のプロット
NZeros(T) = count(zetazeros .≤ T)
AZeros(T) = T/(2π)*log(T/(2π)) - T/(2π)
maxT = maximum(zetazeros)
PP = []
for T in [0:100, 0:maxT/200:maxT]
P = plot(legend=:topleft, xlabel="T")
plot!(title="N(T)", titlefontsize=10)
plot!(T, NZeros.(T), label="\$N(T)\$", lw=1.5)
plot!(T, AZeros.(T), label="\$\\textstyle\\frac{T}{2\\pi}\\log\\frac{T}{2\\pi} - \\frac{T}{2\\pi}\$",
ls=:dash, lw=1.5)
plot!(legendfontsize=10)
push!(PP, P)
end
plot(PP..., size=(800,300))