learn-physics-0.5.2: Haskell code for learning physics

Copyright(c) Scott N. Walck 2014
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Stabilityexperimental
Safe HaskellTrustworthy
LanguageHaskell98

Physics.Learn.Mechanics

Contents

Description

Newton's second law and all that

Synopsis

Documentation

type TheTime = Double Source

Time (in s).

type TimeStep = Double Source

A time step (in s).

type Velocity = Vec Source

Velocity of a particle (in m/s).

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).

simpleStateDeriv Source

Arguments

:: SimpleAccelerationFunction

acceleration function for the particle

-> DifferentialEquation SimpleState

differential equation

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

simpleRungeKuttaStep Source

Arguments

:: 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

data St Source

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

Constructors

St 

data DSt Source

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

Constructors

DSt Vec Vec 

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

Arguments

:: OneParticleAccelerationFunction

acceleration function for the particle

-> DifferentialEquation OneParticleSystemState

differential equation

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

oneParticleRungeKuttaStep Source

Arguments

:: OneParticleAccelerationFunction

acceleration function for the particle

-> TimeStep

time step

-> OneParticleSystemState

initial state

-> OneParticleSystemState

state after one time step

Single Runge-Kutta step

oneParticleRungeKuttaSolution Source

Arguments

:: 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

Arguments

:: TwoParticleAccelerationFunction

acceleration function for two particles

-> DifferentialEquation TwoParticleSystemState

differential equation

Time derivative of state for two particles with constant mass.

twoParticleRungeKuttaStep Source

Arguments

:: 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

Arguments

:: ManyParticleAccelerationFunction

acceleration function for many particles

-> DifferentialEquation ManyParticleSystemState

differential equation

Time derivative of state for many particles with constant mass.

manyParticleRungeKuttaStep Source

Arguments

:: ManyParticleAccelerationFunction

acceleration function

-> TimeStep

time step

-> ManyParticleSystemState

initial state

-> ManyParticleSystemState

state after one time step

Single Runge-Kutta step for many-particle system