Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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
- class (Num a, Floating b, Eq b) => Vec a b | a -> b where
- fromScalar :: b -> a
- dot :: a -> a -> b
- normSq :: a -> b
- norm :: a -> b
- dist :: a -> a -> b
- unitVec :: a -> a
- scalarMult :: b -> a -> a
- data Vec3 a = Vec3 {}
- data Vec2 a = Vec2 {}
- 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
- data CutParams a = CutParams a a
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
Methods
fromScalar :: b -> a Source #
fromScalar
s
returns a unit vector scaled by s
dot
v w
returns the dot product of v
and w
as defined by the
embedded vector space
scalarMult :: b -> a -> a Source #
Vec3
x y z
constructs a three dimensional cartesian vector with
coordinates as noted.
Instances
Eq a => Eq (Vec3 a) Source # | |
Floating a => Num (Vec3 a) Source # | |
Ord a => Ord (Vec3 a) Source # | |
Show a => Show (Vec3 a) Source # | |
Generic (Vec3 a) Source # | |
NFData a => NFData (Vec3 a) Source # | |
Defined in PhysicsVectors | |
(Eq a, Floating a) => Vec (Vec3 a) a Source # | |
type Rep (Vec3 a) Source # | |
Defined in PhysicsVectors type Rep (Vec3 a) = D1 (MetaData "Vec3" "PhysicsVectors" "nbody-0.1.0.0-5vnB4DCzNBqD29X1Eke4fT" False) (C1 (MetaCons "Vec3" PrefixI True) (S1 (MetaSel (Just "x") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: (S1 (MetaSel (Just "y") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Just "z") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))) |
Instances
Eq a => Eq (Vec2 a) Source # | |
Floating a => Num (Vec2 a) Source # | |
Ord a => Ord (Vec2 a) Source # | |
Show a => Show (Vec2 a) Source # | |
Generic (Vec2 a) Source # | |
NFData a => NFData (Vec2 a) Source # | |
Defined in PhysicsVectors | |
(Eq a, Floating a) => Vec (Vec2 a) a Source # | |
type Rep (Vec2 a) Source # | |
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