# Solving equations with QuantityVariable

I'm trying to understand how to easily solve equations that use QuantityVariable.

Why does this fail?

Quantity["Speed of Light"] ==
QuantityVariable[ν, "Frequency"] (2 π)/QuantityVariable[k, "wavenumber"] /.
QuantityVariable[ν, "Frequency"] -> Quantity[2, "THz"]
// Solve


Solve::units: Solve was unable to determine the units of quantities that appear in the input. >>

while this doesn't?

Solve[
QuantityVariable[k, "wavenumber"] == (2 π)/QuantityVariable[λ, "Wavelength"],
QuantityVariable[λ, "Wavelength"]]

{{QuantityVariable[λ,"Wavelength"] -> (2 π)/QuantityVariable[k,"wavenumber"]}}


Nor does this,

Solve[ 3 10^8 == 2 10^12 (2 π)/k]

{{k -> (40000 π)/3}}


Notice that its not necessary to explicitly say which variable to solve in the last example as there is only one possibility, yet that fails if using QuantityVariable.

The question is: Why does my first code fails?

-
Thanks @Öskå for fixing the formatting. I didn't know how to do it myself. –  rhermans Aug 6 '14 at 12:17

Quantity["Speed of Light"] ==
QuantityVariable[\[Nu], "Frequency"] (2 \[Pi])/
QuantityVariable[k, "wavenumber"] /.
QuantityVariable[\[Nu], "Frequency"] -> Quantity[2, "THz"] //

Solve[#, QuantityVariable[k, "wavenumber"]][[1]] &


{QuantityVariable[k,"wavenumber"] -> Quantity[(2000000000000 [Pi])/149896229, 1/("Meters")]}

% // N


{QuantityVariable[k,"wavenumber"] -> Quantity[41916.9, 1/("Meters")]}

speedOfLight =
Quantity["Speed of Light"] //
UnitConvert[#, "m/s"] & //
QuantityMagnitude


299792458

Solve[speedOfLight == 2 10^12 (2 \[Pi])/k][[1]]


{k -> (2000000000000 [Pi])/149896229}

% // N


{k -> 41916.9}

-
Thanks for the reply, but it does not answer why my code fails. You see that in your first example it becomes necessary to explicitly define the variable that needs to be solved if the variable is a QuantityVariable, where in the normal unit-less variable in the last example, there is no need for that. –  rhermans Aug 6 '14 at 14:51
@rhermans I myself avoid using the one-argument syntax of Solve for complex tasks, anyway it's undocumented. And according to my test, it's also slower if one doesn't specify the variable in Solve. –  xzczd Sep 2 '14 at 8:17