LPFP-core-1.1.1: Code for the book Learn Physics with Functional Programming
Copyright(c) Scott N. Walck 2023
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Stabilitystable
Safe HaskellSafe-Inferred
LanguageHaskell2010

LPFPCore.Mechanics3D

Description

Code from chapters 16, 17, and 18 of the book Learn Physics with Functional Programming

Synopsis

Documentation

data ParticleState Source #

Data type for the state of a single particle in three-dimensional space.

Constructors

ParticleState 

Fields

Instances

Instances details
HasTime ParticleState Source # 
Instance details

Defined in LPFPCore.Mechanics3D

Show ParticleState Source # 
Instance details

Defined in LPFPCore.Mechanics3D

Diff ParticleState DParticleState Source # 
Instance details

Defined in LPFPCore.Mechanics3D

defaultParticleState :: ParticleState Source #

A default particle state.

type OneBodyForce = ParticleState -> Vec Source #

Data type for a one-body force.

data DParticleState Source #

Data type for the time-derivative of a particle state.

Constructors

DParticleState 

Fields

newtonSecondPS Source #

Arguments

:: [OneBodyForce] 
-> ParticleState 
-> DParticleState

a differential equation

Given a list of forces, return a differential equation based on Newton's second law.

earthSurfaceGravity :: OneBodyForce Source #

The force of gravity near Earth's surface. The z direction is toward the sky. Assumes SI units.

sunGravity :: OneBodyForce Source #

The force of the Sun's gravity on an object. The origin is at center of the Sun. Assumes SI units.

airResistance Source #

Arguments

:: R

drag coefficient

-> R

air density

-> R

cross-sectional area of object

-> OneBodyForce 

The force of air resistance on an object.

windForce Source #

Arguments

:: Vec

wind velocity

-> R

drag coefficient

-> R

air density

-> R

cross-sectional area of object

-> OneBodyForce 

The force of wind on an object.

uniformLorentzForce Source #

Arguments

:: Vec

E

-> Vec

B

-> OneBodyForce 

The force of uniform electric and magnetic fields on an object.

statesPS Source #

Arguments

:: NumericalMethod ParticleState DParticleState

numerical method

-> [OneBodyForce]

list of force funcs

-> ParticleState 
-> [ParticleState]

evolver

Given a numerical method, a list of one-body forces, and an initial state, return a list of states describing how the particle evolves in time.

updatePS :: NumericalMethod ParticleState DParticleState -> [OneBodyForce] -> ParticleState -> ParticleState Source #

Given a numerical method and a list of one-body forces, return a state-update function.

positionPS Source #

Arguments

:: NumericalMethod ParticleState DParticleState 
-> [OneBodyForce]

list of force funcs

-> ParticleState

initial state

-> Time 
-> PosVec

position function

Given a numerical method, a list of one-body forces, and an initial state, return a position function describing how the particle evolves in time.

class HasTime s where Source #

Methods

timeOf :: s -> Time Source #

Instances

Instances details
HasTime ParticleFieldState Source # 
Instance details

Defined in LPFPCore.Lorentz

HasTime ParticleState Source # 
Instance details

Defined in LPFPCore.Mechanics3D

HasTime MultiParticleState Source # 
Instance details

Defined in LPFPCore.MultipleObjects

airResAtAltitude Source #

Arguments

:: R

drag coefficient

-> R

air density at sea level

-> R

cross-sectional area of object

-> OneBodyForce 

baseballTrajectory :: R -> R -> R -> [(R, R)] Source #

baseballRange :: R -> R -> R -> R Source #

relativityPS :: [OneBodyForce] -> ParticleState -> DParticleState Source #

Given a list of forces, return a differential equation based on the theory of special relativity.