Message Boards Message Boards

0
|
12042 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Simplify units

Posted 10 years ago

Hi,

I was trying to solve a simple equation using variables with units as follows:

UnitConvert[
  Module[{n = 1.46, \[Lambda] = Quantity[ 630 10^-9, "Meters"], 
    Tf = Quantity[1400, "Kalvin"], \[Beta]T = 
     UnitConvert[Quantity[6.8 10^-12, "Centimeters" ^2/"Dynes"], 
      "Meters" ^2/(("Kilograms" "Meters")/("Seconds")^2)], 
    Kb = UnitConvert[Quantity[1, "Poltzmann constant"]]},
   \[Alpha]Scat = (8 \[Pi]^3)/(
     3 \[Lambda]^4) (n^2 - 1) Kb Tf \[Beta]T], (
  "Kilometers")^-1] // UnitSimplify

When the previous code is executed, it seems that UnitSimplify can't cancel the Kalvin dimension in the resulting unit. It would be helpful if somebody can explain this.

Regards

POSTED BY: Saf Al
4 Replies
Posted 10 years ago

I see. Thanks for the clarification.

POSTED BY: Saf Al

You are right. Mathematica has some tolerance when dealing with units and constants. Unfortunately it was not true in the case of Kalvin. Mathematica interpreted "Kalvin" as "Kelvins difference" (DeltaK) and, as a consequence, it was unable to cancel the the Ks. Look at the codes below.

t1 = Quantity[1400, "Kelvin"]
t2 = Quantity[1400, "Kalvin"]
t1 == t2


1400 K
1400 K
Quantity::compat: Kelvins and KelvinsDifference are incompatible units >>
Quantity::compat: Kelvins and KelvinsDifference are incompatible units >>
1400 K == 1400 K

and

t1 = Quantity[1400, "KelvinsDifference"]
t2 = Quantity[1400, "Kalvin"]
t1 == t2

1400 K
1400 K
True

Regards.

Posted 10 years ago

My bad. However. It seems that Mathematica is kind of broad minded, when it comes to "Poltzmann" instead of "Boltzmann", That's to say, it shows the same constant with the same dimensions. Thanks for the answer.

POSTED BY: Saf Al

Try to use "Kelvin" instead of "Kalvin". If you use "Boltzmann" in the place of "Poltzmann", this will help you even more.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract