Tweeted twitter.com/StackMma/status/1063809036125200384
2 added 439 characters in body
source | link

I want to make UnitConvertUnitConvert operate on custom units with special rules.

For instance, I would like to be able to convert between "Hartrees" (or any energy unit) and "Wavenumbers". This conversion is based off of assuming we're working with light, in which case there is a straightforward conversion between the two using the speed of light and Planck's constant.

Optimally, I could do something like:

UnitConvert[Quantity[..., "Hartrees"], "Wavenumbers"]

but of course Mathematica balks as the UnitDimensions aren't actually the same.

How can I do this? I know it won't be easy, but it at least ought to be possible.

I want to make UnitConvert operate on custom units with special rules. How can I do this? I know it won't be easy, but it at least ought to be possible.

I want to make UnitConvert operate on custom units with special rules.

For instance, I would like to be able to convert between "Hartrees" (or any energy unit) and "Wavenumbers". This conversion is based off of assuming we're working with light, in which case there is a straightforward conversion between the two using the speed of light and Planck's constant.

Optimally, I could do something like:

UnitConvert[Quantity[..., "Hartrees"], "Wavenumbers"]

but of course Mathematica balks as the UnitDimensions aren't actually the same.

How can I do this? I know it won't be easy, but it at least ought to be possible.

1
source | link

Custom conversion rules in UnitConvert

I want to make UnitConvert operate on custom units with special rules. How can I do this? I know it won't be easy, but it at least ought to be possible.