# Incompatible Units Problem

I am trying to use quantities with physical units to calculate my result, but I encountered the "Incompatible units" problem. I don't know what is going on. Here is my code, could I have some second-opinions?

Convert[λ^2 Ins/(π ω ℏ) /. ω -> (
2 π c)/λ /. ℏ -> h/(2 π) /. {Ins ->
51*10^-3 Watt/Centimeter^2, c -> SpeedOfLight,
h -> PlanckConstant, λ -> 369*10^-9 Meter}, Hertz]
• Does your code work if you define your variables as Quantitys? I.e. \[Lambda] = Quantity[396*^-9,"Meter"] Commented Oct 11, 2022 at 19:21

UnitConvert[λ^2 Ins/(π ω ℏ) /. ω -> \
(2 π c)/λ /. ℏ -> h/(2 π) /. {Ins ->
Quantity[51*10^-3, "Watts"/("Centimeters")^2],
c -> Entity["PhysicalConstant", "SpeedOfLight"]["Value"],
h -> Entity["PhysicalConstant", "PlanckConstant"][
"Value"], λ -> Quantity[369*10^-9, "Meters"]},
"Hertz"] // N

Quantity[4.10604[Times]10^7, "Hertz"]

Looking at your code, I decided to test the comment I sent you. Try the following:

\[Lambda] = Quantity[369*^-9,"Meters"]
h = Quantity[1, "PlanckConstant"]
c = Quantity[1, "SpeedOfLight"]
Ins = Quantity[51*^-3, "Watts"/"Centimeters"^2]
hBar = h/(2*\[Pi])
Omega = (2 * \[Pi] c)/\[Lambda]

N[UnitConvert[\[Lambda]^2 * Ins/(\[Pi] * Omega * hBar),"Hertz"]]

As far as I'm aware, there's not an easier way to work with units other than the Quantity function.