Copyright | (c) Scott N. Walck 2014-2019 |
---|---|

License | BSD3 (see LICENSE) |

Maintainer | Scott N. Walck <walck@lvc.edu> |

Stability | experimental |

Safe Haskell | Safe |

Language | Haskell98 |

Newton's second law and all that

## Synopsis

- type TheTime = Double
- type TimeStep = Double
- type Velocity = Vec
- type SimpleState = (TheTime, Position, Velocity)
- type SimpleAccelerationFunction = SimpleState -> Vec
- simpleStateDeriv :: SimpleAccelerationFunction -> DifferentialEquation SimpleState
- simpleRungeKuttaStep :: SimpleAccelerationFunction -> TimeStep -> SimpleState -> SimpleState
- data St = St {}
- data DSt = DSt Vec Vec
- type OneParticleSystemState = (TheTime, St)
- type OneParticleAccelerationFunction = OneParticleSystemState -> Vec
- oneParticleStateDeriv :: OneParticleAccelerationFunction -> DifferentialEquation OneParticleSystemState
- oneParticleRungeKuttaStep :: OneParticleAccelerationFunction -> TimeStep -> OneParticleSystemState -> OneParticleSystemState
- oneParticleRungeKuttaSolution :: OneParticleAccelerationFunction -> TimeStep -> OneParticleSystemState -> [OneParticleSystemState]
- type TwoParticleSystemState = (TheTime, St, St)
- type TwoParticleAccelerationFunction = TwoParticleSystemState -> (Vec, Vec)
- twoParticleStateDeriv :: TwoParticleAccelerationFunction -> DifferentialEquation TwoParticleSystemState
- twoParticleRungeKuttaStep :: TwoParticleAccelerationFunction -> TimeStep -> TwoParticleSystemState -> TwoParticleSystemState
- type ManyParticleSystemState = (TheTime, [St])
- type ManyParticleAccelerationFunction = ManyParticleSystemState -> [Vec]
- manyParticleStateDeriv :: ManyParticleAccelerationFunction -> DifferentialEquation ManyParticleSystemState
- manyParticleRungeKuttaStep :: ManyParticleAccelerationFunction -> TimeStep -> ManyParticleSystemState -> ManyParticleSystemState

# Documentation

# Simple one-particle state

type SimpleState = (TheTime, Position, Velocity) Source #

A simple one-particle state, to get started quickly with mechanics of one particle.

type SimpleAccelerationFunction = SimpleState -> Vec Source #

An acceleration function gives the particle's acceleration as a function of the particle's state. The specification of this function is what makes one single-particle mechanics problem different from another. In order to write this function, add all of the forces that act on the particle, and divide this net force by the particle's mass. (Newton's second law).

:: SimpleAccelerationFunction | acceleration function for the particle |

-> DifferentialEquation SimpleState | differential equation |

Time derivative of state for a single particle with a constant mass.

:: SimpleAccelerationFunction | acceleration function for the particle |

-> TimeStep | time step |

-> SimpleState | initial state |

-> SimpleState | state after one time step |

Single Runge-Kutta step

# One-particle state

The state of a single particle is given by the position of the particle and the velocity of the particle.

The associated vector space for the state of a single particle.

type OneParticleSystemState = (TheTime, St) Source #

The state of a system of one particle is given by the current time, the position of the particle, and the velocity of the particle. Including time in the state like this allows us to have time-dependent forces.

type OneParticleAccelerationFunction = OneParticleSystemState -> Vec Source #

An acceleration function gives the particle's acceleration as a function of the particle's state.

oneParticleStateDeriv Source #

:: OneParticleAccelerationFunction | acceleration function for the particle |

-> DifferentialEquation OneParticleSystemState | differential equation |

Time derivative of state for a single particle with a constant mass.

oneParticleRungeKuttaStep Source #

:: OneParticleAccelerationFunction | acceleration function for the particle |

-> TimeStep | time step |

-> OneParticleSystemState | initial state |

-> OneParticleSystemState | state after one time step |

Single Runge-Kutta step

oneParticleRungeKuttaSolution Source #

:: OneParticleAccelerationFunction | acceleration function for the particle |

-> TimeStep | time step |

-> OneParticleSystemState | initial state |

-> [OneParticleSystemState] | state after one time step |

List of system states

# Two-particle state

type TwoParticleSystemState = (TheTime, St, St) Source #

The state of a system of two particles is given by the current time, the position and velocity of particle 1, and the position and velocity of particle 2.

type TwoParticleAccelerationFunction = TwoParticleSystemState -> (Vec, Vec) Source #

An acceleration function gives a pair of accelerations (one for particle 1, one for particle 2) as a function of the system's state.

twoParticleStateDeriv Source #

:: TwoParticleAccelerationFunction | acceleration function for two particles |

-> DifferentialEquation TwoParticleSystemState | differential equation |

Time derivative of state for two particles with constant mass.

twoParticleRungeKuttaStep Source #

:: TwoParticleAccelerationFunction | acceleration function |

-> TimeStep | time step |

-> TwoParticleSystemState | initial state |

-> TwoParticleSystemState | state after one time step |

Single Runge-Kutta step for two-particle system

# Many-particle state

type ManyParticleSystemState = (TheTime, [St]) Source #

The state of a system of many particles is given by the current time and a list of one-particle states.

type ManyParticleAccelerationFunction = ManyParticleSystemState -> [Vec] Source #

An acceleration function gives a list of accelerations (one for each particle) as a function of the system's state.

manyParticleStateDeriv Source #

:: ManyParticleAccelerationFunction | acceleration function for many particles |

-> DifferentialEquation ManyParticleSystemState | differential equation |

Time derivative of state for many particles with constant mass.

manyParticleRungeKuttaStep Source #

:: ManyParticleAccelerationFunction | acceleration function |

-> TimeStep | time step |

-> ManyParticleSystemState | initial state |

-> ManyParticleSystemState | state after one time step |

Single Runge-Kutta step for many-particle system