Hi Marco,
Thanks for your reply. Actually, I was trying to find the intersection points of a curve and a line through NSolve. Obviously, I made a mistake that made Mathematica completely deaf. So you are right, the corrected version of the example is the following:
Module[{\[Lambda]0 = Quantity[850 10^-9, "Meters"], \[Sigma] =
Quantity[32 10^-9, "Meters"] ,
g0 = Quantity[50 10^-2, ("Meters")^-1], \[Alpha]t =
Quantity[32.2 10^-2, ("Meters")^-1],
Length = Quantity[400 10^-6, "Meters"] , n = 3.6},
pts = NSolve[
g0 E^(-(\[Lambda] - \[Lambda]0)^2/(
2 \[Sigma]^2)) == \[Alpha]t, {\[Lambda]}]]
However, I still wonder whether, it is possible to assign a unit to a variable without giving it a value. For example, when you run the following code:
Module[{},
f[\[Lambda]_] = UnitConvert[Quantity[1, "SpeedOfLight"]]/\[Lambda];
f[\[Lambda]]]
Mathematica shows the unit of the function in m/s. That's, of course, because Mathematica doesn't know the unit of Lambda. But, if it was possible to assign Lambda a Unit in Meters, then the unit of the function (f[Lambda]) will be correct, i.e in hertz. Also the function can stay symbolic for future applications. So do you think that such a thing is possible in Mathematica.
Thank you.