Skip to content

Instantly share code, notes, and snippets.

@defeo
Created June 26, 2020 10:56
Show Gist options
  • Save defeo/d09f7007c27e1b65b53c3d26b0207ed0 to your computer and use it in GitHub Desktop.
Save defeo/d09f7007c27e1b65b53c3d26b0207ed0 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using DifferentialEquations, ArgParse
function buchstab_model(dω,ω,h,p,u)
dω[1] = ( h(p, u-1)[1] - ω[1] ) / u
end
function buchstabtab(up, res=1, prec=40)
setprecision(prec) do
buchstab_history(p, u) = 1/u
buchstab_initial = [1/BigFloat(2)]
buchstab_problem = DDEProblem(buchstab_model, buchstab_initial, buchstab_history,
(BigFloat(2), BigFloat(up)+3); constant_lags=[1])
alg = MethodOfSteps(Tsit5())
buchstab = solve(buchstab_problem, alg)
return [(x, buchstab(x)[1]) for x in (BigFloat(2):BigFloat(res):BigFloat(up))]
end
end
s = ArgParseSettings()
@add_arg_table s begin
"--resolution", "-r"
help = "Evaluate at points spaced by this resolution"
arg_type = BigFloat
default = 1/BigFloat(10)
"--precision", "-p"
help = "Use this much floating point precision"
arg_type = Int
default = 40
"bound"
help = "Evaluate up to bound"
arg_type = Int
required = true
end
args = parse_args(ARGS, s)
prec = args["precision"]
table = buchstabtab(args["bound"], args["resolution"], prec)
for (x,bx) in table
print(x, "\t", bx, "\n")
end
2.0 0.50
2.0999999999985 0.52157630634701
2.2000000000007 0.5374190833445
2.2999999999993 0.54885393980112
2.4000000000015 0.55686477484232
2.5 0.56218584807357
2.5999999999985 0.56538554056715
2.7000000000007 0.56689986002948
2.7999999999993 0.56706706796285
2.9000000000015 0.56615605923344
3.0 0.56438242347758
3.0999999999985 0.56266459268045
3.2000000000007 0.56163933379867
3.3000000000029 0.5610950057744
3.4000000000015 0.56086563559256
3.5 0.56083091827531
3.5999999999985 0.56091500129514
3.7000000000007 0.56105937735629
3.8000000000029 0.56121827356947
3.9000000000015 0.56135885112963
4.0 0.56145797496356
4.1000000000058 0.56150891681955
4.1999999999971 0.56152564479453
4.3000000000029 0.56152133876913
4.4000000000015 0.56150650212385
4.5 0.56148896174727
4.6000000000058 0.56147386802786
4.6999999999971 0.56146369486032
4.8000000000029 0.5614582396438
4.9000000000015 0.56145515950448
5.0 0.5614543076872
5.1000000000058 0.56145486287096
5.1999999999971 0.56145602209926
5.3000000000029 0.56145734204711
5.4000000000015 0.56145850755092
5.5 0.56145933161042
5.6000000000058 0.56145975538766
5.6999999999971 0.56145984820796
5.8000000000029 0.5614598069069
5.9000000000015 0.56145975164327
6.0 0.56145966531403
6.0999999999985 0.56145958617253
6.2000000000044 0.56145952622683
6.3000000000029 0.56145948360427
6.4000000000015 0.56145945614844
6.5 0.56145944142099
6.5999999999985 0.5614594366989
6.7000000000044 0.56145943897809
6.8000000000029 0.56145944497257
6.9000000000015 0.56145945111166
7.0 0.56145945486787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment