learn-physics-0.4.3: Haskell code for learning physics

Stabilityexperimental
MaintainerScott N. Walck <walck@lvc.edu>
Safe HaskellTrustworthy

Physics.Learn.Mechanics

Contents

Description

Newton's second law and all that

Synopsis

Documentation

type TheTime = DoubleSource

Time (in s).

type TimeStep = DoubleSource

A time step (in s).

type Velocity = VecSource

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

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

simpleStateDerivSource

Arguments

:: SimpleAccelerationFunction

acceleration function for the particle

-> DifferentialEquation SimpleState

differential equation

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

simpleRungeKuttaStepSource

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 

Instances

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

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

oneParticleStateDerivSource

Arguments

:: OneParticleAccelerationFunction

acceleration function for the particle

-> DifferentialEquation OneParticleSystemState

differential equation

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

oneParticleRungeKuttaStepSource

Arguments

:: OneParticleAccelerationFunction

acceleration function for the particle

-> TimeStep

time step

-> OneParticleSystemState

initial state

-> OneParticleSystemState

state after one time step

Single Runge-Kutta step

oneParticleRungeKuttaSolutionSource

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.

twoParticleStateDerivSource

Arguments

:: TwoParticleAccelerationFunction

acceleration function for two particles

-> DifferentialEquation TwoParticleSystemState

differential equation

Time derivative of state for two particles with constant mass.

twoParticleRungeKuttaStepSource

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.

manyParticleStateDerivSource

Arguments

:: ManyParticleAccelerationFunction

acceleration function for many particles

-> DifferentialEquation ManyParticleSystemState

differential equation

Time derivative of state for many particles with constant mass.

manyParticleRungeKuttaStepSource

Arguments

:: ManyParticleAccelerationFunction

acceleration function

-> TimeStep

time step

-> ManyParticleSystemState

initial state

-> ManyParticleSystemState

state after one time step

Single Runge-Kutta step for many-particle system