Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mathematica physical constants without units

It is helpful to use physical constants included in mathematica. Unfortunately they all include units. This provides errors when trying to integrate numerically. Is there a way just to get the value of a variable without any dimensions?

Thank you! Martin


1 Answers

If e.g. c is the speed of light:

c = UnitConvert[Quantity["SpeedOfLight"]]

Then the obvious way would be to write:

c/Quantity["Meters"/"Seconds"]

Because that way, you're certain the unitless quantity you work with actually means something in m/s, not e.g. ft/hour. In other words: If you wrote c/Quantity["Feet"/"Hours"], the result would be the speed of light, in ft/hour, without a unit attached.

Alternatively, you could always write:

QuantityMagnitude[c]

Which just returns the magnitude, without the unit

like image 85
Niki Avatar answered Oct 16 '25 07:10

Niki