From d7ffd8429e8fa68a43710f2d27c266c5c2ab670c Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Tue, 27 Mar 2012 17:39:45 +0200 Subject: Use generalized Poisson series for VSOP87. --- org/madore/ephem/VSOP87.java | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'org/madore/ephem/VSOP87.java') diff --git a/org/madore/ephem/VSOP87.java b/org/madore/ephem/VSOP87.java index e8a5fb1..442e985 100644 --- a/org/madore/ephem/VSOP87.java +++ b/org/madore/ephem/VSOP87.java @@ -23,14 +23,29 @@ public final class VSOP87 { Variable(String name) { this.name = name; } } - private static EnumMap> data = new EnumMap>(Planet.class); + public static Comput.Polynomial[] lambdas = new Comput.Polynomial[] { + new Comput.Polynomial(4.40260884240, 26087.9031415742), // Mercury + new Comput.Polynomial(3.17614669689, 10213.2855462110), // Venus + new Comput.Polynomial(1.75347045953, 6283.0758499914), // Earth + new Comput.Polynomial(6.20347611291, 3340.6124266998), // Mars + new Comput.Polynomial(0.59954649739, 529.6909650946), // Jupiter + new Comput.Polynomial(0.87401675650, 213.2990954380), // Saturn + new Comput.Polynomial(5.48129387159, 74.7815985673), // Uranus + new Comput.Polynomial(5.31188628676, 38.1330356378), // Neptune + new Comput.Polynomial(5.19846674103, 77713.7714681205), // Moon D + new Comput.Polynomial(1.62790523337, 84334.6615813083), // Moon F + new Comput.Polynomial(2.35555589827, 83286.9142695536), // Moon l + new Comput.Polynomial(3.81034454697, 83997.0911355954) // Moon Lm + }; - public static Comput.SumPoissonTerms getFunc(Planet pl, Variable v) { + private static EnumMap> data = new EnumMap>(Planet.class); + + public static Comput.SumPoisson2Terms getFunc(Planet pl, Variable v) { if ( ! data.containsKey(pl) ) { - data.put(pl, new EnumMap(Variable.class)); + data.put(pl, new EnumMap(Variable.class)); } if ( ! data.get(pl).containsKey(v) ) { - List series = new ArrayList(); + List series = new ArrayList(); try { InputStream str = VSOP87.class.getResourceAsStream("vsop87-simp.dat"); BufferedReader in = new BufferedReader(new InputStreamReader(str, "utf-8")); @@ -40,15 +55,18 @@ public final class VSOP87 { if ( ! fields[0].equals(pl.name) || ! fields[1].equals(v.name) ) continue; int deg = Integer.parseInt(fields[2]); - double c = Double.parseDouble(fields[3]); - double phi = Double.parseDouble(fields[4]); - double om = Double.parseDouble(fields[5]); - series.add(Comput.PoissonTerm.cphi(deg, c, phi, om)); + String[] subfields = fields[3].split(","); + double[] om = new double[12]; + for ( int j=0 ; j<12 ; j++ ) + om[j] = Double.parseDouble(subfields[j]); + double b = Double.parseDouble(fields[4]); + double a = Double.parseDouble(fields[5]); + series.add(Comput.Poisson2Term.ab(deg, a, b, om, lambdas)); } } catch ( Exception e ) { throw new RuntimeException(e); } - data.get(pl).put(v, new Comput.SumPoissonTerms(series)); + data.get(pl).put(v, new Comput.SumPoisson2Terms(series)); } return data.get(pl).get(v); } -- cgit v1.2.3