-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simulates N-Body gravitational dynamics of given data
@package nbody
@version 0.1.0.0


-- | Note that all SI <i>defined</i> quantities are rational numbers as
--   they are <i>precisely</i> defined as such. Any experimentally derived
--   constants are provided as doubles in as much precision as is known
--   modulo floating point errors.
module PhysicsConstants

-- | Newton's Gravitational constant in SI units (m^3 kg^-1 s^-2), usually
--   unused.
nGSI :: Double

-- | Speed of light in SI units (m s^-1)
cSI :: Rational

-- | Speed of light in au units (au days^-1)
cAU :: Rational

-- | Standard Astronomical Unit (au) as defined by IAU2012 in metres
au :: Rational

-- | Standard Astronomical Unit (au) as defined by IAU2012 in kilometres
aukm :: Rational

-- | SI Defined number of seconds in non-standard unit day
secondsInDay :: Rational

-- | Converts Astronomical GM (au^3 days^-2) to SIkm GM (km^3 s^-2)
aGMtoSIGM :: Floating f => f -> f


module PhysicsVectors

-- | The Vec class represents objects embedable within a normed vector
--   space.
--   
--   Implementing Vec requires a concept of a dot product and scalar
--   multiplication with the restriction that the embedded vector space be
--   over a ring with a multiplicative inverse.
--   
--   More formally, instances should satisfy the three dot product rules,
--   with the <a>fromScalar</a> requirement being an explicit
--   representation of the implicit scalar multiplication process through a
--   hadamard product.
--   
--   <ul>
--   <li>&lt;math&gt;</li>
--   <li>&lt;math&gt; and &lt;math&gt;</li>
--   <li>&lt;math&gt;</li>
--   </ul>
class (Num a, Floating b, Eq b) => Vec a b | a -> b

-- | <a>fromScalar</a> <tt>s</tt> returns a unit vector scaled by
--   <tt>s</tt>
fromScalar :: Vec a b => b -> a

-- | <a>dot</a> <tt>v w</tt> returns the dot product of <tt>v</tt> and
--   <tt>w</tt> as defined by the embedded vector space
dot :: Vec a b => a -> a -> b
normSq :: Vec a b => a -> b
norm :: Vec a b => a -> b
dist :: Vec a b => a -> a -> b
unitVec :: Vec a b => a -> a
scalarMult :: Vec a b => b -> a -> a

-- | <a>Vec3</a> <tt>x y z</tt> constructs a three dimensional cartesian
--   vector with coordinates as noted.
data Vec3 a
Vec3 :: a -> a -> a -> Vec3 a
[x] :: Vec3 a -> a
[y] :: Vec3 a -> a
[z] :: Vec3 a -> a

-- | <a>Vec2</a> <tt>v1 v2</tt> constructs a two dimensional column vector
--   of two three dimensional vectors of type <a>Vec3</a>
data Vec2 a
Vec2 :: Vec3 a -> Vec3 a -> Vec2 a
[r] :: Vec2 a -> Vec3 a
[v] :: Vec2 a -> Vec3 a
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (PhysicsVectors.Vec2 a)
instance GHC.Generics.Generic (PhysicsVectors.Vec2 a)
instance GHC.Show.Show a => GHC.Show.Show (PhysicsVectors.Vec2 a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (PhysicsVectors.Vec2 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (PhysicsVectors.Vec2 a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (PhysicsVectors.Vec3 a)
instance GHC.Generics.Generic (PhysicsVectors.Vec3 a)
instance GHC.Show.Show a => GHC.Show.Show (PhysicsVectors.Vec3 a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (PhysicsVectors.Vec3 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (PhysicsVectors.Vec3 a)
instance (GHC.Classes.Eq a, GHC.Float.Floating a) => PhysicsVectors.Vec (PhysicsVectors.Vec2 a) a
instance GHC.Float.Floating a => GHC.Num.Num (PhysicsVectors.Vec2 a)
instance (GHC.Classes.Eq a, GHC.Float.Floating a) => PhysicsVectors.Vec (PhysicsVectors.Vec3 a) a
instance GHC.Float.Floating a => GHC.Num.Num (PhysicsVectors.Vec3 a)


-- | Implements fourth, fifth, and eighth order Runge-Kutta integration
--   methods for time independent second order differential equations using
--   the classic fourth order, Dormand-Prince fifth order, and
--   Cooper-Verner eigth order coefficients respectively. The Gauss-Jackson
--   coefficients are generated to arbitrary order, but using RKCV8 for the
--   startup conditions necessarily restricts the order to eigth order at
--   most, though correction steps can more or less minimise that loss. For
--   some inputs RK4 instead of RKCV8 or RKDP5 may make more sense for
--   startup.
module Integrators

-- | The classic Runge-Kutta fourth order method
rk4 :: (Floating t, Eq t) => Integrator t

-- | Dormand-Prince fifth order method. A less general RK method could
--   avoid the final b calculation and the first f calculation of the next
--   step with this one due to the coefficient choice.
rkdp5 :: (Floating t, Eq t) => Integrator t

-- | Cooper-Verner eigth order method
rkcv8 :: (Floating t, Eq t) => Integrator t

-- | <a>timeIndepRK</a> implements the general Runge-Kutta form for a time
--   independent differential equation &lt;math&gt;.
--   
--   <a>timeIndepRK</a> <tt>btab f yn dt</tt> steps one step forward in the
--   described time-independent Runge-Kutta method where <tt>btab</tt>
--   describes the implementation Butcher-Tableu, <tt>f</tt> the
--   differetial function, <tt>rn</tt> the current position and velocity,
--   and <tt>dt</tt> the integration time step.
--   
--   Note that &lt;math&gt; operates on both position and velocity, i.e. it
--   returns both &lt;math&gt; and &lt;math&gt; and that the
--   Butcher-Tableu's used must have the &lt;math&gt; and &lt;math&gt;
--   coefficients in <i>reverse</i> row order. That is, each row is in
--   reverse order.
timeIndepRK :: (Floating t, Eq t) => BTabTIndep t -> (Vec2 t -> Vec2 t) -> Vec2 t -> t -> Vec2 t

-- | Data class encapsulating the concept of an integrator function
data Integrator t
SingStepIntegrator :: ((Vec2 t -> Vec2 t) -> Vec2 t -> t -> Vec2 t) -> Integrator t
MultStepIntegrator :: ((Vec2 t -> Vec2 t) -> [(Vec2 t, Vec3 t)] -> t -> [(Vec2 t, Vec3 t)]) -> Integrator t
instance GHC.Show.Show n => GHC.Show.Show (Integrators.BTabTIndep n)


module AstroData

-- | Orbital body type storing the Body ID, GM parameter, position-velocity
--   vector, and epoch Note that units are in au days and epoch is normally
--   measured from Julian -- epoch
data OrbitBody f
OrbitBody :: String -> f -> Vec2 f -> f -> OrbitBody f
[bid] :: OrbitBody f -> String
[bGM] :: OrbitBody f -> f
[brv] :: OrbitBody f -> Vec2 f
[epoch] :: OrbitBody f -> f
obPos :: Floating f => OrbitBody f -> Vec3 f
obVel :: Floating f => OrbitBody f -> Vec3 f
updateSvecs :: Floating f => OrbitBody f -> f -> Vec2 f -> OrbitBody f
formatDoubleOB :: OrbitBody Double -> String
instance Control.DeepSeq.NFData f => Control.DeepSeq.NFData (AstroData.OrbitBody f)
instance GHC.Generics.Generic (AstroData.OrbitBody f)
instance GHC.Show.Show f => GHC.Show.Show (AstroData.OrbitBody f)
instance GHC.Classes.Eq f => GHC.Classes.Eq (AstroData.OrbitBody f)


-- | Implements a post-newtonian weak-field approximation gravitational
--   acceleration function and associated vector types required for three
--   dimensional physics.
--   
--   For more information on Post-Newtonian formulations used herein see
--   [1], [2] (Eq. 1) and references therein.
--   
--   <ul>
--   <li><i>1</i> <i>The IAU 2000 Resolutions for Astrometry, Celestial
--   Mechanics, and Metrology in the Relativistic Framework: Explanatory
--   Supplement</i>, <i>Soffel et al.</i>, 2003. Astronomical Journal,
--   126:2687-2706.</li>
--   <li><i>2</i> <i>Cometary Orbit Determination and Nongravitational
--   Forces</i>, <i>Yeomans et al.</i></li>
--   </ul>
module Physics

-- | The Vec class represents objects embedable within a normed vector
--   space.
--   
--   Implementing Vec requires a concept of a dot product and scalar
--   multiplication with the restriction that the embedded vector space be
--   over a ring with a multiplicative inverse.
--   
--   More formally, instances should satisfy the three dot product rules,
--   with the <a>fromScalar</a> requirement being an explicit
--   representation of the implicit scalar multiplication process through a
--   hadamard product.
--   
--   <ul>
--   <li>&lt;math&gt;</li>
--   <li>&lt;math&gt; and &lt;math&gt;</li>
--   <li>&lt;math&gt;</li>
--   </ul>
class (Num a, Floating b, Eq b) => Vec a b | a -> b

-- | <a>fromScalar</a> <tt>s</tt> returns a unit vector scaled by
--   <tt>s</tt>
fromScalar :: Vec a b => b -> a

-- | <a>dot</a> <tt>v w</tt> returns the dot product of <tt>v</tt> and
--   <tt>w</tt> as defined by the embedded vector space
dot :: Vec a b => a -> a -> b
normSq :: Vec a b => a -> b
norm :: Vec a b => a -> b
dist :: Vec a b => a -> a -> b
unitVec :: Vec a b => a -> a
scalarMult :: Vec a b => b -> a -> a

-- | <a>Vec3</a> <tt>x y z</tt> constructs a three dimensional cartesian
--   vector with coordinates as noted.
data Vec3 a
Vec3 :: a -> a -> a -> Vec3 a
[x] :: Vec3 a -> a
[y] :: Vec3 a -> a
[z] :: Vec3 a -> a

-- | <a>Vec2</a> <tt>v1 v2</tt> constructs a two dimensional column vector
--   of two three dimensional vectors of type <a>Vec3</a>
data Vec2 a
Vec2 :: Vec3 a -> Vec3 a -> Vec2 a
[r] :: Vec2 a -> Vec3 a
[v] :: Vec2 a -> Vec3 a

-- | Computes the pair-wise gravitational acceleration between two bodies
pNGRPair :: (Ord f, Floating f) => OrbitBody f -> OrbitBody f -> CutParams f -> Vec3 f
pNGRFull :: (Ord f, Floating f, Traversable t) => t (OrbitBody f) -> OrbitBody f -> CutParams f -> Vec3 f

-- | Cutoff parameters for GR corrections, <a>CutParams</a> <tt>masscut
--   distcut</tt>
data CutParams a
CutParams :: a -> a -> CutParams a

module AsteroidData
asteroids :: Floating f => [OrbitBody f]

module AllBodiesData
allbodies :: Floating f => [OrbitBody f]

module PlanetData
majorbodies :: Floating f => [OrbitBody f]
