Created
March 22, 2023 08:37
-
-
Save tueda/b4d7345f40ed1256f1296444bfa27e3b to your computer and use it in GitHub Desktop.
FORM procedure to approximates some zeta values by rational numbers. #form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chunkifyString[s_String, n_Integer] := | |
StringJoin @@@ Partition[Characters[s], UpTo[n]]; | |
writeRationalApproximation[ | |
stream_, x_, n_, width_:72 | |
] := Module[{s, lines, i}, | |
s = Rationalize[x, Abs[x * 10^(-n)]] // InputForm // ToString; | |
lines = chunkifyString[s, width - 1]; | |
Do[ | |
s = lines[[i]]; | |
If[i < Length[lines], | |
s = s <> "\\"; | |
]; | |
WriteLine[stream, s]; | |
, {i, Length[lines]}]; | |
]; | |
n = 200; | |
constants = Table[ | |
{"z" <> ToString[i], Zeta[i]}, {i, 2, 12} | |
] ~ Join ~ { | |
{"z5z3", SpecialFunctions`MultipleZetaValue[{5, 3}]}, | |
{"z7z3", SpecialFunctions`MultipleZetaValue[{7, 3}]}, | |
{"z9z3", SpecialFunctions`MultipleZetaValue[{9, 3}]}, | |
{"z5z3z3", SpecialFunctions`MultipleZetaValue[{5, 3, 3}]}, | |
{"z6z4z1z1", SpecialFunctions`MultipleZetaValue[{6, 4, 1, 1}]} | |
}; | |
out = OpenWrite["RationalApproximation.prc", BinaryFormat -> True]; | |
WriteLine[out, "#procedure RationalApproximation()"]; | |
WriteLine[out, "* Approximates z2, z3 etc. by rational numbers."]; | |
WriteLine[out, "* The relative errors are < 10^-" <> ToString[n] <> "."]; | |
Do[ | |
WriteLine[out, " id " <> ToString[c[[1]]] <> " = \\"]; | |
writeRationalApproximation[out, c[[2]], n + 0.1]; | |
WriteLine[out, " ;"]; | |
, {c, constants}]; | |
WriteLine[out, "#endprocedure"]; | |
Close[out]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#procedure RationalApproximation() | |
* Approximates z2, z3 etc. by rational numbers. | |
* The relative errors are < 10^-200. | |
id z2 = \ | |
16020477561421692952487130706964323462700663188794863242830247036589271\ | |
925412774344912016394073406219/9739282494232553676474274187877549323464\ | |
250480060655692338461020488417652652504432571071309828391142 | |
; | |
id z3 = \ | |
22900205778039760633800755309246091627637015525974362585845671818945337\ | |
998208464555618946329453959543/1905085002036659311006241247931009390825\ | |
2520945932649399230934116604827261300902939472785087063645452 | |
; | |
id z4 = \ | |
17927734279097906568458659053518841157857583903382328100393844711661041\ | |
467432741678775380083105798569/1656412217783236542503825391890589682291\ | |
6627018594003017360269229526707715002782448866141025907259289 | |
; | |
id z5 = \ | |
10019631834006845890915735791912045131384046751981242656968347612651846\ | |
448223293908329722968096388543/9662806096478235451137463161039974764749\ | |
743657192120723046983388695058417315384212275765047706362024 | |
; | |
id z6 = \ | |
14240641642786716444406574948352270741732048853413689815750283209079013\ | |
893480541071019260227090412743/1399787561828813597633806805340887330928\ | |
2222272530255724787274916767158942132278303064033244949560181 | |
; | |
id z7 = \ | |
10003775654518472179328462365950159181212595201836124848608408319553129\ | |
804033065087933012109479477027/9920942949939198104836171480706809555019\ | |
041486786646171017569865621882118462058545244827663928586931 | |
; | |
id z8 = \ | |
40787740933520804515988056999909137902613590142734931586603469098589930\ | |
33580703072666515126002722549/40622110121045183458862471061540533150382\ | |
79603013821433408369245232515380041628372813952473048006811 | |
; | |
id z9 = \ | |
35629138685937025281785238317553599485296383911212889161231536005734139\ | |
63737417328850389628804016709/35557724806523797291661250307333621655163\ | |
09852506844145165356285153613171732908871153981398558666212 | |
; | |
id z10 = \ | |
10791366655691279491343243491206331133838755390218747293907250378819341\ | |
603403302914895537344599292451/1078064449481488763644454456534692274399\ | |
6296892467632778925978994566359335057413324403497449086719253 | |
; | |
id z11 = \ | |
48296103505229214266995002237392658539603735632773200590801362287462237\ | |
51290180335542983021938814105/48272247910416656719558231429793909488284\ | |
79394896726908094492792787474704290755983101767106789629277 | |
; | |
id z12 = \ | |
14075090131725826273206160379596285211344069192703488269414746274255543\ | |
349538576223914619675182147945/1407162729346574182852916958016101369854\ | |
2704194906842595006978562243797391307266040075785806985331596 | |
; | |
id z5z3 = \ | |
17617859193452652888737471212731697034210877756678661676726111627328593\ | |
46467889183638222478707153921/46722212745751284127190723160910640951146\ | |
361432029184668839885198760539552151501994585476261341926016 | |
; | |
id z7z3 = \ | |
10363620777973984600800316131162869684341364170204288961183796600616180\ | |
68791604872882737435669379635/12308822816673558919790317128254611397840\ | |
9707583552095062008265500468081845815157192763461160793286239 | |
; | |
id z9z3 = \ | |
92893839306146309479613867913681705129990452985321002587374056192530643\ | |
9200756779487824176169779507/460902271345016416070850924778860878264196\ | |
349176248351919498172888040717261975507898069724815173433821 | |
; | |
id z5z3z3 = \ | |
39858636711025994206772381295241219153251689127897521436352920955834054\ | |
6025645276162926255866485537/505044876843925870839119622379459191622892\ | |
994874325382816468723492843903919722828483385746072214454316 | |
; | |
id z6z4z1z1 = \ | |
22755073682775958710309660864070582291154393234059293222863179447779599\ | |
875436932363342236819763954/8545109335266554688533007993952857015793148\ | |
989052715942152138563147259592817714358626670354013813021071 | |
; | |
#endprocedure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment