Wolfram mathematica mathematica没有单位的物理常数

Wolfram mathematica mathematica没有单位的物理常数,wolfram-mathematica,integration,constants,units-of-measurement,Wolfram Mathematica,Integration,Constants,Units Of Measurement,使用mathematica中包含的物理常数很有帮助。不幸的是,它们都包括单位。这会在尝试进行数值积分时产生错误。有没有一种方法可以在没有任何维度的情况下获取变量的值 谢谢大家!! 马丁也许这会有帮助 In[1]:= sol = UnitConvert[Quantity["SpeedOfLight"]] Out[1]= 299792458 m/s In[2]:= FullForm[sol] Out[2]//FullForm= Quantity[299792458,Times[Meters,P

使用mathematica中包含的物理常数很有帮助。不幸的是,它们都包括单位。这会在尝试进行数值积分时产生错误。有没有一种方法可以在没有任何维度的情况下获取变量的值

谢谢大家!! 马丁

也许这会有帮助

In[1]:= sol = UnitConvert[Quantity["SpeedOfLight"]]

Out[1]= 299792458 m/s

In[2]:= FullForm[sol]

Out[2]//FullForm= Quantity[299792458,Times[Meters,Power[Seconds,-1]]]

In[3]:= mysol = First[sol]

Out[3]= 299792458

In[4]:= FullForm[mysol]

Out[4]//FullForm= 299792458

如果例如
c
是光速:

c = UnitConvert[Quantity["SpeedOfLight"]]
那么最明显的方式就是写:

c/Quantity["Meters"/"Seconds"]
因为那样的话,你就可以确定你工作的无单位量实际上是以米/秒表示的,而不是以英尺/小时表示的。换句话说:如果你写了
c/Quantity[“Feet”/“Hours”]
,结果将是光速,单位为ft/hour,没有附加单位

或者,你也可以写:

QuantityMagnitude[c]

它只返回幅值,不带单位

您也可以将所需单位提供给
UnitConvert
,即
QuantityMagnitude@UnitConvert[数量[“光速”],“英尺”/“秒”]