Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ca7632ac49e1
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a734e885613b
Choose a head ref
  • 16 commits
  • 14 files changed
  • 1 contributor

Commits on Jun 25, 2019

  1. Copy the full SHA
    e78abda View commit details
  2. Copy the full SHA
    35e5871 View commit details
  3. Copy the full SHA
    3d019b7 View commit details

Commits on Jun 26, 2019

  1. Explain the large-ish errors.

    pleroy committed Jun 26, 2019
    Copy the full SHA
    7eae245 View commit details

Commits on Jun 28, 2019

  1. Copy the full SHA
    b82eef3 View commit details

Commits on Jun 29, 2019

  1. Copy the full SHA
    624010f View commit details
  2. Copy the full SHA
    f4300d9 View commit details

Commits on Jun 30, 2019

  1. Resharper settings.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    6eee3cd View commit details
  2. Correct values near π/2.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    edb492f View commit details
  3. New tabulated tests.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    7bc2f10 View commit details
  4. Copy the full SHA
    07c86ca View commit details
  5. More data points.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    2626273 View commit details
  6. Keep testing near m=1.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    0447c74 View commit details
  7. Test the elliptic functions.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    1de8b0e View commit details
  8. Remove old data file.

    pleroy committed Jun 30, 2019
    Copy the full SHA
    c81ff6b View commit details
  9. Merge pull request #2232 from pleroy/Tests

    New tests for the elliptic integrals and functions
    pleroy authored Jun 30, 2019
    Copy the full SHA
    a734e88 View commit details
7 changes: 5 additions & 2 deletions Principia.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -81,11 +81,13 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Locals/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Parameters/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="_" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="_" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="_" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="_" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Property/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypeParameters/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FCONSTANT/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FFUNCTION/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
@@ -185,4 +187,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=psychohistory/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rotator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=trihedron/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unmanageability/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unmanageability/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0447_0435_0431_044B_0448_0451_0432/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
72 changes: 72 additions & 0 deletions mathematica/elliptic_functions.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
(* ::Package:: *)

(* ::Section:: *)
(*Definitions*)


(* ::Input:: *)
(*decimalFloatLiteral[x_Real,exponentWidth_Integer]:=*)
(* With[*)
(* {m=If[x==0,0,MantissaExponent[x][[1]]*10],*)
(* e=If[x==0,0,MantissaExponent[x][[2]]-1]},*)
(* StringJoin[*)
(* StringRiffle[#,""]&/@*)
(* {{#[[1]]},*)
(* If[Length[#]>1,{"."},Nothing],*)
(* If[Length[#]>1,StringPartition[#[[2]],UpTo[5]],Nothing],*)
(* If[e!=0,"e"<>If[e>0,"+","-"]<>IntegerString[e,10,exponentWidth],Nothing]}&[*)
(* StringSplit[ToString[m],"."]]]]*)


(* ::Input:: *)
(*decimalFloatLiteral[0,_]:="0"*)


(* ::Section:: *)
(*Random arguments with denser distribution near m=1*)


(* ::Input:: *)
(*SeedRandom[666]*)


(* ::Input:: *)
(*randomu=Sort[RandomReal[{-10,10},60,WorkingPrecision->20]];*)


(* ::Input:: *)
(*randomm=Sort[Select[1-RandomVariate[HalfNormalDistribution[3],60,WorkingPrecision->20],#>=0&]];*)


(* ::Input:: *)
(*randomargs=Flatten[Outer[List,randomu,randomm],1];*)


(* ::Input:: *)
(*randomvals=Map[*)
(*{*)
(*JacobiSN[#[[1]],#[[2]]],JacobiCN[#[[1]],#[[2]]],JacobiDN[#[[1]],#[[2]]]}&,*)
(*randomargs];*)


(* ::Input:: *)
(*randomstrs=Map[*)
(*"entry { argument: "<>decimalFloatLiteral[#[[1]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[5]],2]<>*)
(*"}"*)
(*&,*)
(*Join[randomargs,randomvals,2]];*)


(* ::Input:: *)
(*SetDirectory[NotebookDirectory[]]*)


(* ::Input:: *)
(*Export[*)
(*"..\\numerics\\elliptic_functions.proto.txt",*)
(*StringRiffle[randomstrs,"\n"],*)
(*"text"]*)
212 changes: 190 additions & 22 deletions mathematica/elliptic_integrals.wl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
(* ::Package:: *)

(* ::Section:: *)
(*Definitions*)


(* ::Input:: *)
(*fukushimaB[\[CurlyPhi]_,m_]:=(EllipticE[\[CurlyPhi],m]-(1-m)EllipticF[\[CurlyPhi],m])/m*)

@@ -15,8 +19,8 @@
(* ::Input:: *)
(*decimalFloatLiteral[x_Real,exponentWidth_Integer]:=*)
(* With[*)
(* {m=MantissaExponent[x][[1]]*10,*)
(* e=MantissaExponent[x][[2]]-1},*)
(* {m=If[x==0,0,MantissaExponent[x][[1]]*10],*)
(* e=If[x==0,0,MantissaExponent[x][[2]]-1]},*)
(* StringJoin[*)
(* StringRiffle[#,""]&/@*)
(* {{#[[1]]},*)
@@ -26,50 +30,214 @@
(* StringSplit[ToString[m],"."]]]]*)


(* ::Input:: *)
(*decimalFloatLiteral[0,_]:="0"*)


(* ::Section:: *)
(*Random arguments with denser distribution near \[CurlyPhi]=\[Pi]/2 and m=1*)


(* ::Subsection:: *)
(*Bivariate integrals*)


(* ::Input:: *)
(*SeedRandom[666]*)


(* ::Input:: *)
(*random\[CurlyPhi]=Sort[RandomReal[{0,\[Pi]/2},10,WorkingPrecision->20]]*)
(*random\[CurlyPhi]=Sort[Select[\[Pi]/2-RandomVariate[HalfNormalDistribution[2],60,WorkingPrecision->20],#>=0&]];*)


(* ::Input:: *)
(*randomn=Sort[RandomReal[{0,1},10,WorkingPrecision->20]]*)
(*randomm=Sort[Select[1-RandomVariate[HalfNormalDistribution[3],60,WorkingPrecision->20],#>=0&]];*)


(* ::Input:: *)
(*randomm=Sort[RandomReal[{999/1000,1},10,WorkingPrecision->20]]*)
(*randomargs2=Flatten[Outer[List,random\[CurlyPhi],randomm],1];*)


(* ::Input:: *)
(*args=Flatten[Outer[List,randomn,randomm,random\[CurlyPhi]],2];*)
(*randomvals2=Map[*)
(*{*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaB[#[[1]],m],m->0],*)
(*fukushimaB[#[[1]],#[[2]]]],*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaD[#[[1]],m],m->0],*)
(*fukushimaD[#[[1]],#[[2]]]]}&,*)
(*randomargs2];*)


(* ::Input:: *)
(*vals=Map[*)
(*randomstrs2=Map[*)
(*"entry { argument: "<>decimalFloatLiteral[#[[1]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*"}"*)
(*&,*)
(*Join[randomargs2,randomvals2,2]];*)


(* ::Input:: *)
(*SetDirectory[NotebookDirectory[]]*)


(* ::Input:: *)
(*Export[*)
(*"..\\numerics\\bivariate_elliptic_integrals.proto.txt",*)
(*StringRiffle[randomstrs2,"\n"],*)
(*"text"]*)


(* ::Subsection:: *)
(*Trivariate integral*)


(* ::Input:: *)
(*SeedRandom[666]*)


(* ::Input:: *)
(*random\[CurlyPhi]=Sort[Select[\[Pi]/2-RandomVariate[HalfNormalDistribution[2],15,WorkingPrecision->20],#>=0&]];*)


(* ::Input:: *)
(*randomm=Sort[Select[1-RandomVariate[HalfNormalDistribution[3],15,WorkingPrecision->20],#>=0&]];*)


(* ::Input:: *)
(*randomn=Sort[RandomReal[{0,1},15,WorkingPrecision->20]];*)


(* ::Input:: *)
(*randomargs3=Flatten[Outer[List,random\[CurlyPhi],randomn,randomm],2];*)


(* ::Input:: *)
(*randomvals3=Map[*)
(*{*)
(*#[[1]],#[[2]],#[[3]],*)
(*fukushimaB[#[[3]],#[[2]]],*)
(*fukushimaD[#[[3]],#[[2]]],*)
(*fukushimaJ[#[[3]],#[[1]],#[[2]]]*)
(*}&,*)
(*args,*)
(*{1}];*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaJ[#[[1]],n,#[[3]]],n->0],*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]]}&,*)
(*randomargs3];*)


(* ::Input:: *)
(*strs=Map[*)
(*randomstrs3=Map[*)
(*"entry { argument: "<>decimalFloatLiteral[#[[1]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[fukushimaB[#[[3]],#[[2]]],2]<>*)
(*" value: "<>decimalFloatLiteral[fukushimaD[#[[3]],#[[2]]],2]<>*)
(*" value: "<>decimalFloatLiteral[fukushimaJ[#[[3]],#[[1]],#[[2]]],2] <>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*"}"*)
(*&,*)
(*Join[randomargs3,randomvals3,2]];*)


(* ::Subsubsection:: *)
(*A case that used to have a bug*)


(* ::Input:: *)
(*SeedRandom[666]*)


(* ::Input:: *)
(*random1\[CurlyPhi]=Sort[RandomReal[{0,\[Pi]/2},10,WorkingPrecision->20]];*)


(* ::Input:: *)
(*random1m=Sort[RandomReal[{999/1000,1},10,WorkingPrecision->20]];*)


(* ::Input:: *)
(*random1n=Sort[RandomReal[{0,1},10,WorkingPrecision->20]];*)


(* ::Input:: *)
(*random1args3=Flatten[Outer[List,random1\[CurlyPhi],random1n,random1m],2];*)


(* ::Input:: *)
(*random1vals3=Map[*)
(*{*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaJ[#[[1]],n,#[[3]]],n->0],*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]]}&,*)
(*random1args3];*)


(* ::Input:: *)
(*random1strs3=Map[*)
(*"entry { argument: "<>decimalFloatLiteral[#[[1]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*"}"*)
(*&,*)
(*Join[random1args3,random1vals3,2]];*)


(* ::Input:: *)
(*SetDirectory[NotebookDirectory[]]*)


(* ::Input:: *)
(*Export[*)
(*"..\\numerics\\trivariate_elliptic_integrals.proto.txt",*)
(*StringRiffle[Flatten[{randomstrs3,random1strs3}],"\n"],*)
(*"text"]*)


(* ::Section:: *)
(*xeldbj near \[CurlyPhi]=\[Pi]/2*)


(* ::Input:: *)
(*xelbdj\[CurlyPhi]={14148475504056880/2^53}*)


(* ::Input:: *)
(*xelbdjn={9005001498122835/2^53,3/4,1/2,1/4,0}*)


(* ::Input:: *)
(*xelbdjm={1-8842084905851963/2^159,3/4,1/2,1/4,0}*)


(* ::Input:: *)
(*xelbdjargs=Flatten[Outer[List,xelbdjn,xelbdjm,xelbdj\[CurlyPhi]],2];*)


(* ::Input:: *)
(*xelbdjvals=Map[*)
(*N[{*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaB[#[[3]],m],m->0],*)
(*fukushimaB[#[[3]],#[[2]]]],*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaD[#[[3]],m],m->0],*)
(*fukushimaD[#[[3]],#[[2]]]],*)
(*If[#[[1]]==0,*)
(*Limit[fukushimaJ[#[[3]],n,#[[2]]],n->0],*)
(*fukushimaJ[#[[3]],#[[1]],#[[2]]]]*)
(*},60]&,*)
(*xelbdjargs];*)


(* ::Input:: *)
(*xelbdjstrs=Map[*)
(*"entry { argument: "<>decimalFloatLiteral[N[#[[1]],5],2]<>*)
(*" argument: "<>decimalFloatLiteral[N[#[[2]],5],2]<>*)
(*" argument: "<>decimalFloatLiteral[N[#[[3]]/\[Pi],5],2]<>*)
(*" value: "<>decimalFloatLiteral[N[#[[4]],21],2]<>*)
(*" value: "<>decimalFloatLiteral[N[#[[5]],21],2]<>*)
(*" value: "<>decimalFloatLiteral[N[#[[6]],21],2] <>*)
(*"}"*)
(*&,*)
(*args,*)
(*{1}];*)
(*Join[xelbdjargs,xelbdjvals,2]];*)


(* ::Input:: *)
@@ -78,6 +246,6 @@

(* ::Input:: *)
(*Export[*)
(*"..\\numerics\\elliptic_integrals.proto.txt",*)
(*StringRiffle[strs,"\n"],*)
(*"..\\temp\\xelbdj_\[Pi]_over_2.proto.txt",*)
(*StringRiffle[xelbdjstrs,"\n"],*)
(*"text"]*)
2 changes: 1 addition & 1 deletion mathematica/fukushima_elliptic_bd.wl
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@


(* ::Input:: *)
(*fukushimaB[\[CurlyPhi]_,m_]:=(EllipticE[\[CurlyPhi],m]-m EllipticF[\[CurlyPhi],m])/m*)
(*fukushimaB[\[CurlyPhi]_,m_]:=(EllipticE[\[CurlyPhi],m]-(1-m) EllipticF[\[CurlyPhi],m])/m*)


(* ::Input:: *)
Loading