JuliaPhysics / JuliaPhysics/Unitful.jl
Converting between unit systems
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
It would be nice to have the ability to transform from on unit system, say standard SI, to another, say atomic units, without having to specify the explicit units as with `uconvert`.
I'm not sure exactly how to go about it. One way would be have a function
``` Julia
system = u"g * km * eV"
simplify(a, system)
```
We can then project `units(simplify(a))` (simplified as in #34) onto the units in the second argument + an orthogonal subspace of units defined by: (i) just SI units, or (ii) the units of `simplify(a * system)` over each individual dimension. I think I would go for (ii).
One caveat is users entering a unit system that is not linearly independent.
Another possibility is to define a new type with an appropriate `*` operator. And then proceed in a fairly similar manner. The difference is that the type and associated arithmetic could be made to guarantee that the units are linearly independent. And `uconvert(a, system)` could be used.
Comments and preferences?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.