learn-physics-0.6.7: Haskell code for learning physics
Copyright(c) Scott N. Walck 2012-2019
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

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

Instances details
Show Vec Source # 
Instance details

Defined in Physics.Learn.CommonVec

Methods

showsPrec :: Int -> Vec -> ShowS #

show :: Vec -> String #

showList :: [Vec] -> ShowS #

Eq Vec Source # 
Instance details

Defined in Physics.Learn.CommonVec

Methods

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

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

StateSpace Vec Source # 
Instance details

Defined in Physics.Learn.StateSpace

Associated Types

type Diff Vec Source #

Methods

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

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

AdditiveGroup Vec Source # 
Instance details

Defined in Physics.Learn.CarrotVec

Methods

zeroV :: Vec #

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

negateV :: Vec -> Vec #

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

InnerSpace Vec Source # 
Instance details

Defined in Physics.Learn.CarrotVec

Methods

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

VectorSpace Vec Source # 
Instance details

Defined in Physics.Learn.CarrotVec

Associated Types

type Scalar Vec #

Methods

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

type Diff Vec Source # 
Instance details

Defined in Physics.Learn.StateSpace

type Diff Vec = Vec
type Scalar Vec Source # 
Instance details

Defined in Physics.Learn.CarrotVec

type Scalar Vec = R

type R = Double Source #

xComp :: Vec -> R Source #

x component

yComp :: Vec -> R Source #

y component

zComp :: Vec -> R Source #

z component

vec Source #

Arguments

:: R

x component

-> R

y component

-> R

z component

-> Vec 

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

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

Vector addition.

(^-^) :: 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 :: Vec -> R Source #

Magnitude of a vector.

zeroV :: Vec Source #

The zero vector.

negateV :: Vec -> Vec Source #

The additive inverse of a vector.

sumV :: [Vec] -> Vec Source #

Sum of a list of vectors.

iHat :: Vec Source #

Unit vector in the x direction.

jHat :: Vec Source #

Unit vector in the y direction.

kHat :: Vec Source #

Unit vector in the z direction.