learn-physics-0.6.2: Haskell code for learning physics

Copyright (c) Scott N. Walck 2012-2018 BSD3 (see LICENSE) Scott N. Walck experimental Safe Haskell98

Physics.Learn.Position

Description

A module for working with the idea of position and coordinate systems.

Synopsis

# Documentation

data Position Source #

A type for position. Position is not a vector because it makes no sense to add positions.

Instances

 Source # MethodsshowList :: [Position] -> ShowS # Source # Position is not a vector, but displacement (difference in position) is a vector. Associated Typestype Diff Position :: * Source # Methods type Diff Position Source # type Diff Position = Vec

A displacement is a vector.

A scalar field associates a number with each position in space.

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.

The Cartesian coordinate system. Coordinates are (x,y,z).

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.

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.

Arguments

 :: Double x coordinate -> Double y coordinate -> Double z coordinate -> Position

A helping function to take three numbers x, y, and z and form the appropriate position using Cartesian coordinates.

Arguments

 :: Double s coordinate -> Double phi coordinate -> Double z coordinate -> Position

A helping function to take three numbers s, phi, and z and form the appropriate position using cylindrical coordinates.

Arguments

 :: Double r coordinate -> Double theta coordinate -> Double phi coordinate -> Position

A helping function to take three numbers r, theta, and phi and form the appropriate position using spherical coordinates.

Returns the three Cartesian coordinates as a triple from a position.

Returns the three cylindrical coordinates as a triple from a position.

Returns the three spherical coordinates as a triple from a position.

Arguments

 :: Position source position -> Position target position -> Displacement

Displacement from source position to target position.

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.

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.

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.

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.

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.

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.

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.

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.