nbody-0.1.0.0

Safe HaskellSafe
LanguageHaskell2010

Physics

Description

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.

1
The IAU 2000 Resolutions for Astrometry, Celestial Mechanics, and Metrology in the Relativistic Framework: Explanatory Supplement, Soffel et al., 2003. Astronomical Journal, 126:2687-2706.
2
Cometary Orbit Determination and Nongravitational Forces, Yeomans et al.
Synopsis

Documentation

class (Num a, Floating b, Eq b) => Vec a b | a -> b where Source #

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 fromScalar requirement being an explicit representation of the implicit scalar multiplication process through a hadamard product.

  • \( x \cdot y = \overline{y \cdot x} \)
  • \( ax \cdot y = a(x \cdot y)\) and \((x + y) \cdot z = x \cdot z + x \cdot y \)
  • \( x \cdot x \geq 0 \)

Minimal complete definition

fromScalar, dot

Methods

fromScalar :: b -> a Source #

fromScalar s returns a unit vector scaled by s

dot :: a -> a -> b Source #

dot v w returns the dot product of v and w as defined by the embedded vector space

normSq :: a -> b Source #

norm :: a -> b Source #

dist :: a -> a -> b Source #

unitVec :: a -> a Source #

scalarMult :: b -> a -> a Source #

Instances
(Eq a, Floating a) => Vec (Vec2 a) a Source # 
Instance details

Defined in PhysicsVectors

Methods

fromScalar :: a -> Vec2 a Source #

dot :: Vec2 a -> Vec2 a -> a Source #

normSq :: Vec2 a -> a Source #

norm :: Vec2 a -> a Source #

dist :: Vec2 a -> Vec2 a -> a Source #

unitVec :: Vec2 a -> Vec2 a Source #

scalarMult :: a -> Vec2 a -> Vec2 a Source #

(Eq a, Floating a) => Vec (Vec3 a) a Source # 
Instance details

Defined in PhysicsVectors

Methods

fromScalar :: a -> Vec3 a Source #

dot :: Vec3 a -> Vec3 a -> a Source #

normSq :: Vec3 a -> a Source #

norm :: Vec3 a -> a Source #

dist :: Vec3 a -> Vec3 a -> a Source #

unitVec :: Vec3 a -> Vec3 a Source #

scalarMult :: a -> Vec3 a -> Vec3 a Source #

data Vec3 a Source #

Vec3 x y z constructs a three dimensional cartesian vector with coordinates as noted.

Constructors

Vec3 

Fields

  • x :: a
     
  • y :: a
     
  • z :: a
     
Instances
Eq a => Eq (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

(==) :: Vec3 a -> Vec3 a -> Bool #

(/=) :: Vec3 a -> Vec3 a -> Bool #

Floating a => Num (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

(+) :: Vec3 a -> Vec3 a -> Vec3 a #

(-) :: Vec3 a -> Vec3 a -> Vec3 a #

(*) :: Vec3 a -> Vec3 a -> Vec3 a #

negate :: Vec3 a -> Vec3 a #

abs :: Vec3 a -> Vec3 a #

signum :: Vec3 a -> Vec3 a #

fromInteger :: Integer -> Vec3 a #

Ord a => Ord (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

compare :: Vec3 a -> Vec3 a -> Ordering #

(<) :: Vec3 a -> Vec3 a -> Bool #

(<=) :: Vec3 a -> Vec3 a -> Bool #

(>) :: Vec3 a -> Vec3 a -> Bool #

(>=) :: Vec3 a -> Vec3 a -> Bool #

max :: Vec3 a -> Vec3 a -> Vec3 a #

min :: Vec3 a -> Vec3 a -> Vec3 a #

Show a => Show (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

showsPrec :: Int -> Vec3 a -> ShowS #

show :: Vec3 a -> String #

showList :: [Vec3 a] -> ShowS #

Generic (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Associated Types

type Rep (Vec3 a) :: Type -> Type #

Methods

from :: Vec3 a -> Rep (Vec3 a) x #

to :: Rep (Vec3 a) x -> Vec3 a #

NFData a => NFData (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

rnf :: Vec3 a -> () #

(Eq a, Floating a) => Vec (Vec3 a) a Source # 
Instance details

Defined in PhysicsVectors

Methods

fromScalar :: a -> Vec3 a Source #

dot :: Vec3 a -> Vec3 a -> a Source #

normSq :: Vec3 a -> a Source #

norm :: Vec3 a -> a Source #

dist :: Vec3 a -> Vec3 a -> a Source #

unitVec :: Vec3 a -> Vec3 a Source #

scalarMult :: a -> Vec3 a -> Vec3 a Source #

type Rep (Vec3 a) Source # 
Instance details

Defined in PhysicsVectors

data Vec2 a Source #

Vec2 v1 v2 constructs a two dimensional column vector of two three dimensional vectors of type Vec3

Constructors

Vec2 

Fields

Instances
Eq a => Eq (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

(==) :: Vec2 a -> Vec2 a -> Bool #

(/=) :: Vec2 a -> Vec2 a -> Bool #

Floating a => Num (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

(+) :: Vec2 a -> Vec2 a -> Vec2 a #

(-) :: Vec2 a -> Vec2 a -> Vec2 a #

(*) :: Vec2 a -> Vec2 a -> Vec2 a #

negate :: Vec2 a -> Vec2 a #

abs :: Vec2 a -> Vec2 a #

signum :: Vec2 a -> Vec2 a #

fromInteger :: Integer -> Vec2 a #

Ord a => Ord (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

compare :: Vec2 a -> Vec2 a -> Ordering #

(<) :: Vec2 a -> Vec2 a -> Bool #

(<=) :: Vec2 a -> Vec2 a -> Bool #

(>) :: Vec2 a -> Vec2 a -> Bool #

(>=) :: Vec2 a -> Vec2 a -> Bool #

max :: Vec2 a -> Vec2 a -> Vec2 a #

min :: Vec2 a -> Vec2 a -> Vec2 a #

Show a => Show (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

showsPrec :: Int -> Vec2 a -> ShowS #

show :: Vec2 a -> String #

showList :: [Vec2 a] -> ShowS #

Generic (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Associated Types

type Rep (Vec2 a) :: Type -> Type #

Methods

from :: Vec2 a -> Rep (Vec2 a) x #

to :: Rep (Vec2 a) x -> Vec2 a #

NFData a => NFData (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

Methods

rnf :: Vec2 a -> () #

(Eq a, Floating a) => Vec (Vec2 a) a Source # 
Instance details

Defined in PhysicsVectors

Methods

fromScalar :: a -> Vec2 a Source #

dot :: Vec2 a -> Vec2 a -> a Source #

normSq :: Vec2 a -> a Source #

norm :: Vec2 a -> a Source #

dist :: Vec2 a -> Vec2 a -> a Source #

unitVec :: Vec2 a -> Vec2 a Source #

scalarMult :: a -> Vec2 a -> Vec2 a Source #

type Rep (Vec2 a) Source # 
Instance details

Defined in PhysicsVectors

type Rep (Vec2 a) = D1 (MetaData "Vec2" "PhysicsVectors" "nbody-0.1.0.0-5vnB4DCzNBqD29X1Eke4fT" False) (C1 (MetaCons "Vec2" PrefixI True) (S1 (MetaSel (Just "r") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vec3 a)) :*: S1 (MetaSel (Just "v") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vec3 a))))

pNGRPair :: (Ord f, Floating f) => OrbitBody f -> OrbitBody f -> CutParams f -> Vec3 f Source #

Computes the pair-wise gravitational acceleration between two bodies

pNGRFull :: (Ord f, Floating f, Traversable t) => t (OrbitBody f) -> OrbitBody f -> CutParams f -> Vec3 f Source #

data CutParams a Source #

Cutoff parameters for GR corrections, CutParams masscut distcut

Constructors

CutParams a a