Copyright | (c) Scott N. Walck 2012-2019 |
---|---|
License | BSD3 (see LICENSE) |
Maintainer | Scott N. Walck <walck@lvc.edu> |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell98 |
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
- data Vec
- type R = Double
- xComp :: Vec -> R
- yComp :: Vec -> R
- zComp :: Vec -> R
- vec :: R -> R -> R -> Vec
- (^+^) :: Vec -> Vec -> Vec
- (^-^) :: Vec -> Vec -> Vec
- (*^) :: R -> Vec -> Vec
- (^*) :: Vec -> R -> Vec
- (^/) :: Vec -> R -> Vec
- (<.>) :: Vec -> Vec -> R
- (><) :: Vec -> Vec -> Vec
- magnitude :: Vec -> R
- zeroV :: Vec
- negateV :: Vec -> Vec
- sumV :: [Vec] -> Vec
- iHat :: Vec
- jHat :: Vec
- kHat :: Vec
Documentation
A type for vectors.
Form a vector by giving its x, y, and z components.
(*^) :: R -> Vec -> Vec infixl 7 Source #
Scalar multiplication, where the scalar is on the left and the vector is on the right.