Canonical ensemble #
A canonical ensemble describes a system in thermal equilibrium with a heat bath at a fixed temperature.
In this file we define the canonical ensemble, its partition function, the probability of being in a given microstate, the mean energy, the entropy and the Helmholtz free energy.
We also define the addition of two canonical ensembles, and prove results related to the properties of additions of canonical ensembles.
## References
A Canonical ensemble is described by a type ι
, corresponding to the type of microstates,
and a map ι → ℝ
which associates which each microstate an energy.
Equations
- CanonicalEnsemble ι = (ι → ℝ)
Instances For
The addition of two CanonicalEnsemble
.
Equations
- CanonicalEnsemble.instHAddProd = { hAdd := fun (𝓒1 : CanonicalEnsemble ι1) (𝓒2 : CanonicalEnsemble ι2) (i : ι1 × ι2) => 𝓒1 i.1 + 𝓒2 i.2 }
Scalar multiplication of CanonicalEnsemble
, defined such that
nsmul n 𝓒
is n
coppies of the canonical ensemble 𝓒
.
Equations
- CanonicalEnsemble.nsmul n 𝓒1 f = ∑ i : Fin n, 𝓒1 (f i)
Instances For
The microstates of a the canonical ensemble
Equations
- 𝓒.microstates = ι
Instances For
The energy of the microstates #
The energy of associated with a mircrostate of the canonical ensemble.
Instances For
The partition function of the canonical ensemble #
The partition function of the canonical ensemble.
Equations
- 𝓒.partitionFunction T = ∑ i : 𝓒.microstates, Real.exp (-T.β * 𝓒.energy i)
Instances For
The partition function of the canonical ensemble as a function of β
Equations
- 𝓒.partitionFunctionβ β = ∑ i : 𝓒.microstates, Real.exp (-β * 𝓒.energy i)
Instances For
The probability of being in a given microstate #
The probability of been in a given microstate.
Equations
- 𝓒.probability i T = Real.exp (-T.β * 𝓒.energy i) / 𝓒.partitionFunction T
Instances For
The mean energy of the canonical ensemble #
The mean energy of the canonical ensemble.
Equations
- 𝓒.meanEnergy T = ∑ i : 𝓒.microstates, 𝓒.energy i * 𝓒.probability i T
Instances For
Entropy #
The entropy of the canonical ensemble.
Equations
- 𝓒.entropy T = -↑Constants.kB * ∑ i : 𝓒.microstates, 𝓒.probability i T * Real.log (𝓒.probability i T)
Instances For
Entropy is addative on adding canonical ensembles.
Helmholtz free energy #
The (Helmholtz) free energy of the canonical ensemble.
Equations
- 𝓒.helmholtzFreeEnergy T = 𝓒.meanEnergy T - T.toReal * 𝓒.entropy T
Instances For
The Helmholtz free energy is addative.