# Bug recognizing “Wavenumbers” as a unit of energy?

Wavenumbers, aka inverse centimeters, has dimensions of energy and thus should be easily convertible to joules. MMA clearly recognizes "Wavenumbers" at some level, since it autosuggests this unit when I begin to type it in the UnitConvert command (see last input at the bottom of the first screenshot below; MMA offers this autosuggestion even on a fresh kernel). Yet when I attempt to evaluate the command, it fails, incorrectly stating that "Wavenumbers and Joules are incompatible units" (see In(5) in first screenshot).

Perhaps correspondingly, I'm getting odd behavior from Wolfram Alpha when I attempt to use it to perform the conversion. Note that it fails in In(1). Yet I recalled a previous notebook in which it worked. If I copy that cell and paste it into this notebook, it works (see In(2)). But when I try copying and pasting just the text from In(2) into a new cell and then evaluating it, it fails (see In(3)). I.e., if I copy and paste the entire working cell, it evaluates successfully, but if I copy and paste its text only, it fails to evaluate.

I should further add that, when I subsequently clicked the "+" sign at the upper right of a failed Wolfram Alpha conversion (e.g., In[3]), the expanded result did indeed provide the correct conversion (see second screenshot).

• This is more a physics question, but it seems the energy is more an 'equivalence' than a direct 'unit conversion'. Just key in "wavenumber" to alpha and you see "conversions to other units" as all reciprocal length, then down the page energy is listed as a "corresponding quantity". – george2079 Dec 22 '16 at 21:53
• Yeah, wavenumbers is a unit of energy only if you have values for fundamental constants like $c$. It's not a unit of energy, and converting it to energy is not the same as, e.g. converting inches to meters. (Though, there's probably some semantics going on here.) – march Dec 22 '16 at 22:44
• But anyway, I'm not getting any errors here. My copy of Mathematica converts between the two units just fine. – march Dec 22 '16 at 22:46
• @march: When you say your copy of MMA converts just fine, do you mean it converts directly from wavenumbers to joules, implicitly including the values of c and h, or do you need to include those, i.e.: UnitConvert[ Quantity[25.7, "Wavenumbers"]*Quantity["PlanckConstant"]*Quantity["SpeedOfLight"], "Joules"] – theorist Dec 22 '16 at 23:44
• @theorist. I'll clarify. Doing the double-equal sign to start the semantic interpreter (and call to Wolfram Alpha) and entering "convert 22.7 wavenumbers to joules" worked just fine. Doing UnitConvert[Quantity[22.7, "Wavenumbers"], "Joules"] did not, and I'm guessing this is because under the hood, "Wavenumbers" is a length, which then Mathematica doesn't know how to convert that to energy. I like Simon Rochester's solution. – march Dec 22 '16 at 23:48

As noted in the comments, inverse centimeters do not have dimensions of energy, unless you consider $h$ and $c$ to be dimensionless, which Mathematica has no way to tell that you are doing. (Wolfram|Alpha can guess that you want that, but Mathematica, thankfully, is designed not to try to guess.)

One approach would be to define

wavenumbers = "Wavenumbers" "PlanckConstant" "SpeedOfLight"


Now you can do

UnitConvert[Quantity[25.7, wavenumbers], "Joules"]


UnitConvert[%, wavenumbers]