0以上の整数 $n$ に対する

$$ \sum_{k=0}^n \frac{(it)^k}{k!} = \exp(it) - \sum_{k=n+1}^\infty \frac{(it)^k}{k!} $$

は, $n$ について連続的に

$$ \exp(it) - \sum_{\nu=1}^\infty \frac{(it)^{n+\nu}}{\Gamma(n+\nu+1)} = \exp(it) - \sum_{\nu=1}^\infty \frac{\exp((n+\nu)(\log t + \pi i/2))}{\Gamma(n+\nu+1)} $$

で補間できる. これは fractional derivative に基く補間になっている.

https://twitter.com/InertialObservr/status/1233502763339976704

In [1]:
using SpecialFunctions
using Printf
using Plots
pyplot()
pyplotclf() = backend() == Plots.PyPlotBackend() && PyPlot.clf()
Out[1]:
pyplotclf (generic function with 1 method)
In [2]:
cg(n, nmax) = cgrad(:lighttest)[1 - 0.85*n/nmax]
[cg(n, 20) for n in 0:0.05:20]
Out[2]:
In [3]:
f(n, t) = sum((im*t)^k/factorial(k) for k in 0:n)
t = range(0, 2π, length=400)
nmax = 20
ns = [0;0; 0:nmax; nmax;nmax]
@time anim = @animate for n in ns
    plot(size=(400, 410), aspect_ratio=1)
    plot!(fgcolor=:white, bgcolor=:black)
    plot!(xlim=(-2,2), ylim=(-2,2))
    nstr = @sprintf("%2d", n)
    plot!(title="n = $nstr"; titlefontsize=10)
    z = f.(n, t)
    a = f.(n, π .* (0:0.5:1.5))
    plot!(real(z), imag(z); label="", color=cg(n, nmax), lw=1.2)
    scatter!(real(a), imag(a); label="", color=cg(n, nmax), markerstrokecolor=cg(n, nmax))
end
pyplotclf()
gif(anim, "exp_it.gif", fps=2)
 23.567523 seconds (28.85 M allocations: 1.480 GiB, 2.01% gc time)
┌ Info: Saved animation to 
│   fn = C:\Users\genkuroki\OneDrive\Math\Math0034\exp_it.gif
└ @ Plots C:\Users\genkuroki\.julia\packages\Plots\u8HRI\src\animation.jl:104
Out[3]:
In [4]:
f(n, t) = sum((im*t)^k/gamma(k+1) for k in 0:n)
t = range(0, 6π, length=1000)
nmax = 52
ns = [0;0; 0:nmax; nmax;nmax]
@time anim = @animate for n in ns
    plot(size=(400, 410), aspect_ratio=1)
    plot!(fgcolor=:white, bgcolor=:black)
    plot!(xlim=(-2,2), ylim=(-2,2))
    nstr = @sprintf("%2d", n)
    plot!(title="n = $nstr"; titlefontsize=10)
    z = f.(n, t)
    a = f.(n, π .* (0:0.5:5.5))
    plot!(real(z), imag(z); label="", color=cg(n, nmax), lw=2, alpha=0.5)
    scatter!(real(a), imag(a); label="", color=cg(n, nmax), markerstrokecolor=cg(n, nmax), alpha=0.5)
end
pyplotclf()
gif(anim, "exp_it_2.gif", fps=2)
  6.713974 seconds (1.87 M allocations: 104.679 MiB, 0.25% gc time)
┌ Info: Saved animation to 
│   fn = C:\Users\genkuroki\OneDrive\Math\Math0034\exp_it_2.gif
└ @ Plots C:\Users\genkuroki\.julia\packages\Plots\u8HRI\src\animation.jl:104
Out[4]:
In [5]:
f(n, t; N=20) = exp(im*t) - sum(exp(k*(log(t)+im*(π/2)) - logabsgamma(k+1)[1]) for k in n+1:n+N)
nmax = 20
fps = 20
ns = [fill(0.00, fps); 0.00:0.05:nmax; fill(nmax, fps)]
t = range(0, 2π, length=400)
@time anim = @animate for n in ns
    plot(size=(400, 410), aspect_ratio=1)
    plot!(fgcolor=:white, bgcolor=:black)
    plot!(xlim=(-2,2), ylim=(-2,2))
    nstr = @sprintf("%5.2f", n)
    plot!(title="n = $nstr"; titlefontsize=10)
    z = f.(n, t)
    a = f.(n, π .* (0:0.5:1.5))
    plot!(real(z), imag(z); label="", color=cg(n, nmax), lw=1.2)
    scatter!(real(a), imag(a); label="", color=cg(n, nmax), markerstrokecolor=cg(n, nmax))
end
pyplotclf()
gif(anim, "exp_it_smooth.gif", fps=fps)
 45.672522 seconds (8.33 M allocations: 449.513 MiB, 0.28% gc time)
┌ Info: Saved animation to 
│   fn = C:\Users\genkuroki\OneDrive\Math\Math0034\exp_it_smooth.gif
└ @ Plots C:\Users\genkuroki\.julia\packages\Plots\u8HRI\src\animation.jl:104
Out[5]: