Message Boards Message Boards

0
|
10330 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

QuantityUnit and QuantityMagnitude doesn't work

Posted 11 years ago
Needs["StandardAtmosphere`"]
test = MeanDensity[100 Meter]
QuantityMagnitude[test]
QuantityUnit[test]
MeanDensity gives values in kg/m^3. But I can't seem to get just the numerical value with QuantityMagnitude?

What I'm trying to do in the end is integrate the air density over all the atmosphere volume to get the total atmosphere mass. I'll use NIntegrate afterwards.
POSTED BY: Gandalf Saxe
4 Replies
Symbolic Integration with units:
  http://reference.wolfram.com/mathematica/tutorial/SymbolicCalculationsWithUnits.html 
POSTED BY: Bruce Miller
Posted 11 years ago
Thanks for the answers. Is this the easiest way of getting rid of the units of MeanDensity in preparation for integration?

Also, can the units simply be integrated somehow without problem?
POSTED BY: Gandalf Saxe
QuantityMagnitude and QuantityUnit work on Quantity objects as follows
In[3]:= QuantityMagnitude[Quantity[1.21346`, "Kilograms"/"Meters"^3]]

Out[3]= 1.21346

In[8]:= QuantityUnit[Quantity[1.21346`, "Kilograms"/"Meters"^3]]

Out[8]= ("Kilograms")/("Meters")^3
MeanDensity[100 Meter] did not evaluate to a Quantity object.
In[9]:= MeanDensity[100 Meter]

Out[9]= (1.21346 Kilogram)/Meter^3
However, giving the appropriate Quantity object to MeanDensity 
In[14]:= MeanDensity[Quantity[100, "Meters"]]
Out[14]= Quantity[1.21346, ("Kilograms")/("Meters")^3]
So
In[15]:= QuantityMagnitude@MeanDensity[Quantity[100, "Meters"]]
Out[15]= 1.21346
Hi,

Try
test = MeanDensity[Quantity[100, "Meters"]]

Youngjoo Chung
POSTED BY: Youngjoo Chung
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