Skip to content

Commit

Permalink
revised charge accuracy calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed May 30, 2021
1 parent 34dae05 commit 2685298
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "UnitSystems"
uuid = "3a241a3c-2137-41aa-af5e-1388e404ca09"
authors = ["Michael Reed"]
version = "0.3"
version = "0.3.1"

[compat]
julia = "1"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ However, the `UnitfulSystems` package has fewer `UnitSystem` specifications avai
Specifically, `Metric`, `SI2019`, `CODATA`, `Conventional`, `MTS`, `EMU2019`, `English`, and `EnglishUS` can have `Unitful` values; while `Gauss`, `LorentzHeaviside`, `Thomson`, `EMU`, `ESU`, `ESU2019`, `IAU`, `FFF`, `Planck`, `PlanckGauss`, `Stoney`, `Hartree`, `Rydberg`, `Schrodinger`, `Electronic`, `Natural`, `NaturalGauss`, `QCD`, `QCDGauss`, and `QCDoriginal` are plain valued or are limited to `Measurement` values.

```Julia
pkg> add UnitSystems # or UnitfulSystems
pkg> add UnitSystems # or MeasureSystems

julia> using UnitSystems
```
Expand Down Expand Up @@ -44,7 +44,7 @@ Physics constant documentation is at https://geophysics.crucialflow.com/dev/cons

Additional reference `UnitSystem` variants: `EMU`, `ESU`, `Gauss`, `LorentzHeaviside`, `MTS`, `SI2019`, `CODATA`, `Conventional`, `IAU`, `EnglishUS`; and natural atomic units based on gravitational coupling `αG` and the fine structure `1/αinv` constant (`Planck`, `PlanckGauss`, `Stoney`, `Hartree`, `Rydberg`, `Schrodinger`, `Electronic`, `Natural`, `NaturalGauss`, `QCD`, `QCDGauss`, and `QCDoriginal`).

Unt conversion documentation is at https://geophysics.crucialflow.com/dev/convert
Unit conversion documentation is at https://geophysics.crucialflow.com/dev/convert

**Derived Unit conversions:**

Expand Down
3 changes: 1 addition & 2 deletions src/UnitSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ Base.display(U::UnitSystem) = println("UnitSystem{kB=$(boltzmann(U)),ħ=$(planck
@pure planckmass(U::UnitSystem,C::Coupling=universe(U)) = electronmass(U,C)/√coupling(C)
@pure planck(U::UnitSystem,C::Coupling=universe(U)) = 2π*planckreduced(U,C)
@pure newton(U::UnitSystem,C::Coupling=universe(U)) = lightspeed(U,C)*planckreduced(U,C)/planckmass(U,C)^2
@pure charge(U::UnitSystem,C::Coupling=universe(U)) = sqrt(2planck(U,C)*finestructure(C)/impedance(U,C))
@pure impedance(U::UnitSystem,C::Coupling=universe(U)) = permeability(U,C)*lightspeed(U,C)*rationalization(U)*lorentz(U)^2
@pure charge(U::UnitSystem,C::Coupling=universe(U)) = sqrt(2planck(U)/(permeability(U)/finestructure(U))/(lightspeed(U)*rationalization(U)*lorentz(U)^2))

for unit (:coupling,:finestructure,:electronunit,:protonunit,:protonelectron)
@eval @pure $unit(U::UnitSystem) = $unit(universe(U))
Expand Down
9 changes: 5 additions & 4 deletions src/physics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ julia> planckreduced(SI2019) # J⋅s⋅rad⁻¹
$(planckreduced(SI2019))
julia> planckreduced(SI2019)*lightspeed(SI2019) # J⋅m⋅rad⁻¹
$(planckreduced(SI2019)*𝘤)
$(planckreduced(SI2019)*lightspeed(SI2019))
julia> planckreduced(CODATA) # J⋅s⋅rad⁻¹
$(planckreduced(CODATA))
julia> planckreduced(Conventional) # J⋅s⋅rad⁻¹
$(planckreduced(Conventional))
julia> planckreduced(SI2019)/electronmass(SI2019) # eV⋅s⋅rad⁻¹
julia> planckreduced(SI2019)/charge(SI2019) # eV⋅s⋅rad⁻¹
$(planckreduced(SI2019)/charge(SI2019))
julia> planckreduced(SI2019)*lightspeed(SI2019)/charge(SI2019) # eV⋅m⋅rad⁻¹
Expand Down Expand Up @@ -144,8 +144,8 @@ $(planck(CODATA))
julia> planck(Conventional) # J⋅s
$(planck(Conventional))
julia> planck(SI2019)/electronmass(SI2019) # eV⋅s⋅rad⁻¹
$(planck(SI2019)/𝘦)
julia> planck(SI2019)/charge(SI2019) # eV⋅s⋅rad⁻¹
$(planck(SI2019)/charge(SI2019))
julia> planck(SI2019)*lightspeed(SI2019)/charge(SI2019) # eV⋅m⋅rad⁻¹
$(planck(SI2019)*lightspeed(SI2019)/charge(SI2019))
Expand Down Expand Up @@ -576,6 +576,7 @@ $(ampere(HLU))
```
""" ampere, kₘ, km

@pure impedance(U::UnitSystem,C::Coupling=universe(U)) = permeability(U,C)*lightspeed(U,C)*rationalization(U)*lorentz(U)^2
@doc """
impedance(U::UnitSystem) = permeability(U)*lightspeed(U)*rationalization(U)*lorentz(U)^2
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ for S ∈ UnitSystems.Systems
@test stefan(U) 32π^5*planck(U)/15lightspeed(U)^6*αinv^8*(universal(U)*rydberg(U)/μₑᵤ/molarmass(U))^4
end
@testset "radiationdensity" begin
@test radiationdensity(U) == 4stefan(U)/lightspeed(U)
@test radiationdensity(U) 4stefan(U)/lightspeed(U)
@test radiationdensity(U) 8π^5*boltzmann(U)^4/15planck(U)^3/lightspeed(U)^3
@test radiationdensity(U) π^2*boltzmann(U)^4/15planckreduced(U)^3/lightspeed(U)^3
@test radiationdensity(U) 2^7*π^5*planck(U)/15lightspeed(U)^7*αinv^8*(universal(U)*rydberg(U)/μₑᵤ/molarmass(U))^4
Expand Down

2 comments on commit 2685298

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/37819

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 2685298452f7efc269262b67d9b66ef623637023
git push origin v0.3.1

Please sign in to comment.