learn-physics-0.6.2: Haskell code for learning physics

Copyright(c) Scott N. Walck 2012-2014
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell98

Physics.Learn.SimpleVec

Description

Basic operations on the vector type Vec, such as vector addition and scalar multiplication. This module is simple in the sense that the operations on vectors all have simple, concrete types, without the need for type classes. This makes using and reasoning about vector operations easier for a person just learning Haskell.

Synopsis

Documentation

data Vec #

A type for vectors.

Instances
Eq Vec # 
Instance details

Defined in Physics.Learn.CommonVec

Methods

(==) :: Vec -> Vec -> Bool #

(/=) :: Vec -> Vec -> Bool #

Show Vec # 
Instance details

Defined in Physics.Learn.CommonVec

Methods

showsPrec :: Int -> Vec -> ShowS #

show :: Vec -> String #

showList :: [Vec] -> ShowS #

VectorSpace Vec # 
Instance details

Defined in Physics.Learn.CarrotVec

Associated Types

type Scalar Vec :: * #

Methods

(*^) :: Scalar Vec -> Vec -> Vec #

InnerSpace Vec # 
Instance details

Defined in Physics.Learn.CarrotVec

Methods

(<.>) :: Vec -> Vec -> Scalar Vec #

AdditiveGroup Vec # 
Instance details

Defined in Physics.Learn.CarrotVec

Methods

zeroV :: Vec #

(^+^) :: Vec -> Vec -> Vec #

negateV :: Vec -> Vec #

(^-^) :: Vec -> Vec -> Vec #

StateSpace Vec # 
Instance details

Defined in Physics.Learn.StateSpace

Associated Types

type Diff Vec :: * #

Methods

(.-.) :: Vec -> Vec -> Diff Vec #

(.+^) :: Vec -> Diff Vec -> Vec #

type Scalar Vec # 
Instance details

Defined in Physics.Learn.CarrotVec

type Diff Vec # 
Instance details

Defined in Physics.Learn.StateSpace

type Diff Vec = Vec

xComp :: Vec -> Double #

x component

yComp :: Vec -> Double #

y component

zComp :: Vec -> Double #

z component

vec #

Arguments

:: Double

x component

-> Double

y component

-> Double

z component

-> Vec 

Form a vector by giving its x, y, and z components.

(^+^) :: Vec -> Vec -> Vec infixl 6 #

Vector addition.

(^-^) :: Vec -> Vec -> Vec infixl 6 #

Vector subtraction.

(*^) :: Double -> Vec -> Vec infixl 7 #

Scalar multiplication, where the scalar is on the left and the vector is on the right.

(^*) :: Vec -> Double -> Vec infixl 7 #

Scalar multiplication, where the scalar is on the right and the vector is on the left.

(^/) :: Vec -> Double -> Vec infixl 7 #

Division of a vector by a scalar.

(<.>) :: Vec -> Vec -> Double infixl 7 #

Dot product of two vectors.

(><) :: Vec -> Vec -> Vec infixl 7 #

Cross product.

magnitude :: Vec -> Double #

Magnitude of a vector.

zeroV :: Vec #

The zero vector.

negateV :: Vec -> Vec #

The additive inverse of a vector.

sumV :: [Vec] -> Vec #

Sum of a list of vectors.

iHat :: Vec #

Unit vector in the x direction.

jHat :: Vec #

Unit vector in the y direction.

kHat :: Vec #

Unit vector in the z direction.