learn-physics-0.6.4: Haskell code for learning physics

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 Source #

A type for vectors.

Instances
 Source # Instance detailsDefined in Physics.Learn.CommonVec Methods(==) :: Vec -> Vec -> Bool #(/=) :: Vec -> Vec -> Bool # Source # Instance detailsDefined in Physics.Learn.CommonVec MethodsshowsPrec :: Int -> Vec -> ShowS #show :: Vec -> String #showList :: [Vec] -> ShowS # Source # Instance detailsDefined in Physics.Learn.CarrotVec Associated Typestype Scalar Vec :: Type # Methods(*^) :: Scalar Vec -> Vec -> Vec # Source # Instance detailsDefined in Physics.Learn.CarrotVec Methods(<.>) :: Vec -> Vec -> Scalar Vec # Source # Instance detailsDefined in Physics.Learn.CarrotVec Methods(^+^) :: Vec -> Vec -> Vec #negateV :: Vec -> Vec #(^-^) :: Vec -> Vec -> Vec # Source # Instance detailsDefined in Physics.Learn.StateSpace Associated Typestype Diff Vec :: Type Source # Methods type Scalar Vec Source # Instance detailsDefined in Physics.Learn.CarrotVec type Scalar Vec = Double type Diff Vec Source # Instance detailsDefined in Physics.Learn.StateSpace type Diff Vec = Vec

type R = Double Source #

x component

y component

z component

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 Source #

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

Vector subtraction.

(*^) :: R -> Vec -> Vec infixl 7 Source #

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

(^*) :: Vec -> R -> Vec infixl 7 Source #

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

(^/) :: Vec -> R -> Vec infixl 7 Source #

Division of a vector by a scalar.

(<.>) :: Vec -> Vec -> R infixl 7 Source #

Dot product of two vectors.

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

Cross product.

Magnitude of a vector.

The zero vector.

The additive inverse of a vector.

sumV :: [Vec] -> Vec Source #

Sum of a list of vectors.

Unit vector in the x direction.

Unit vector in the y direction.

Unit vector in the z direction.