Copyright | (c) Scott N. Walck 2012-2018 |
---|---|
License | BSD3 (see LICENSE) |
Maintainer | Scott N. Walck <walck@lvc.edu> |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell98 |
A module for working with the idea of position and coordinate systems.
- data Position
- type Displacement = Vec
- type ScalarField = Position -> Double
- type VectorField = Position -> Vec
- type Field v = Position -> v
- type CoordinateSystem = (Double, Double, Double) -> Position
- cartesian :: CoordinateSystem
- cylindrical :: CoordinateSystem
- spherical :: CoordinateSystem
- cart :: Double -> Double -> Double -> Position
- cyl :: Double -> Double -> Double -> Position
- sph :: Double -> Double -> Double -> Position
- cartesianCoordinates :: Position -> (Double, Double, Double)
- cylindricalCoordinates :: Position -> (Double, Double, Double)
- sphericalCoordinates :: Position -> (Double, Double, Double)
- displacement :: Position -> Position -> Displacement
- shiftPosition :: Displacement -> Position -> Position
- shiftObject :: Displacement -> (a -> Position) -> a -> Position
- shiftField :: Displacement -> (Position -> v) -> Position -> v
- addFields :: AdditiveGroup v => [Field v] -> Field v
- rHat :: VectorField
- thetaHat :: VectorField
- phiHat :: VectorField
- sHat :: VectorField
- xHat :: VectorField
- yHat :: VectorField
- zHat :: VectorField
Documentation
A type for position. Position is not a vector because it makes no sense to add positions.
type Displacement = Vec Source #
A displacement is a vector.
type ScalarField = Position -> Double Source #
A scalar field associates a number with each position in space.
type VectorField = Position -> Vec Source #
A vector field associates a vector with each position in space.
type Field v = Position -> v Source #
Sometimes we want to be able to talk about a field without saying whether it is a scalar field or a vector field.
type CoordinateSystem = (Double, Double, Double) -> Position Source #
A coordinate system is a function from three parameters to space.
cartesian :: CoordinateSystem Source #
The Cartesian coordinate system. Coordinates are (x,y,z).
cylindrical :: CoordinateSystem Source #
The cylindrical coordinate system. Coordinates are (s,phi,z), where s is the distance from the z axis and phi is the angle with the x axis.
spherical :: CoordinateSystem Source #
The spherical coordinate system. Coordinates are (r,theta,phi), where r is the distance from the origin, theta is the angle with the z axis, and phi is the azimuthal angle.
A helping function to take three numbers x, y, and z and form the appropriate position using Cartesian coordinates.
A helping function to take three numbers s, phi, and z and form the appropriate position using cylindrical coordinates.
A helping function to take three numbers r, theta, and phi and form the appropriate position using spherical coordinates.
cartesianCoordinates :: Position -> (Double, Double, Double) Source #
Returns the three Cartesian coordinates as a triple from a position.
cylindricalCoordinates :: Position -> (Double, Double, Double) Source #
Returns the three cylindrical coordinates as a triple from a position.
sphericalCoordinates :: Position -> (Double, Double, Double) Source #
Returns the three spherical coordinates as a triple from a position.
:: Position | source position |
-> Position | target position |
-> Displacement |
Displacement from source position to target position.
shiftPosition :: Displacement -> Position -> Position Source #
Shift a position by a displacement.
shiftObject :: Displacement -> (a -> Position) -> a -> Position Source #
An object is a map into Position
.
shiftField :: Displacement -> (Position -> v) -> Position -> v Source #
A field is a map from Position
.
addFields :: AdditiveGroup v => [Field v] -> Field v Source #
Add two scalar fields or two vector fields.
rHat :: VectorField Source #
The vector field in which each point in space is associated
with a unit vector in the direction of increasing spherical coordinate
r, while spherical coordinates theta and phi
are held constant.
Defined everywhere except at the origin.
The unit vector rHat
points in different directions at different points
in space. It is therefore better interpreted as a vector field, rather
than a vector.
thetaHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing spherical coordinate theta, while spherical coordinates r and phi are held constant. Defined everywhere except on the z axis.
phiHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing (cylindrical or spherical) coordinate phi, while cylindrical coordinates s and z (or spherical coordinates r and theta) are held constant. Defined everywhere except on the z axis.
sHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing cylindrical coordinate s, while cylindrical coordinates phi and z are held constant. Defined everywhere except on the z axis.
xHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing Cartesian coordinate x, while Cartesian coordinates y and z are held constant. Defined everywhere.
yHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing Cartesian coordinate y, while Cartesian coordinates x and z are held constant. Defined everywhere.
zHat :: VectorField Source #
The vector field in which each point in space is associated with a unit vector in the direction of increasing Cartesian coordinate z, while Cartesian coordinates x and y are held constant. Defined everywhere.