learn-physics-0.2: Haskell code for learning physics

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

Physics.Learn.Charge

Contents

Description

This module contains functions for working with charge, electric field, electric flux, and electric potential.

Synopsis

Charge

type Charge = DoubleSource

Charge is just a synonym for a double-precision floating point number.

data ChargeDistribution Source

A charge distribution is a point charge, a line charge, a surface charge, a volume charge, or a combination of these. The ScalarField describes a linear charge density, a surface charge density, or a volume charge density.

Constructors

PointCharge Charge Position

point charge

LineCharge ScalarField Curve

ScalarField is linear charge density

SurfaceCharge ScalarField Surface

ScalarField is surface charge density

VolumeCharge ScalarField Volume

ScalarField is volume charge density

Multiple [ChargeDistribution]

combination of charge distributions

Electric Field

eField :: ChargeDistribution -> VectorFieldSource

The electric field produced by a charge distribution. This is the simplest way to find the electric field, because it works for any charge distribution (point, line, surface, volume, or combination).

eFieldFromPointChargeSource

Arguments

:: Charge

charge (in Coulombs)

-> Position

of point charge

-> VectorField

electric field

Electric field produced by a point charge. The function eField calls this function to evaluate the electric field produced by a point charge.

eFieldFromLineChargeSource

Arguments

:: ScalarField

linear charge density lambda

-> Curve

geometry of the line charge

-> VectorField

electric field

Electric field produced by a line charge. The function eField calls this function to evaluate the electric field produced by a line charge.

eFieldFromSurfaceChargeSource

Arguments

:: ScalarField

surface charge density sigma

-> Surface

geometry of the surface charge

-> VectorField

electric field

Electric field produced by a surface charge. The function eField calls this function to evaluate the electric field produced by a surface charge.

eFieldFromVolumeChargeSource

Arguments

:: ScalarField

volume charge density rho

-> Volume

geometry of the volume charge

-> VectorField

electric field

Electric field produced by a volume charge. The function eField calls this function to evaluate the electric field produced by a volume charge.

Electric Flux

electricFlux :: Surface -> ChargeDistribution -> DoubleSource

The electric flux through a surface produced by a charge distribution.

Electric Potential

electricPotentialFromFieldSource

Arguments

:: Position

position where electric potential is zero

-> VectorField

electric field

-> ScalarField

electric potential

Electric potential from electric field, given a position to be the zero of electric potential.

electricPotentialFromCharge :: ChargeDistribution -> ScalarFieldSource

Electric potential produced by a charge distribution. The position where the electric potential is zero is taken to be infinity.