1
$\begingroup$

I asked a similar question yesterday, which was answered splendidly, but I missed adding a detail.

Attached is a command, its output, and the issue I have now. This outputs g/cm^3, but I'd rather have the units in kg/m^3.

I guess I don't know how to handle the command which outputs all the data at once. How can the units be changed for this kind of output?

Thank you (again)enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ For future reference, please add your code as text, and not as pictures, so we don't have to retype it ourselves. $\endgroup$
    – MarcoB
    Commented Jan 5, 2021 at 19:13

1 Answer 1

3
$\begingroup$
UnitConvert[
 PlanetData[PlanetData[], "Density", "EntityAssociation"],
 "Kilograms"/"Meters"^3
]

Of course I am sure you are aware that the two units result in the same numerical results, i.e. 1 g/cm^3 = 1 kg/m^3.

$\endgroup$
4
  • 3
    $\begingroup$ Pipped me by 31 seconds :) $\endgroup$
    – Carl Lange
    Commented Jan 5, 2021 at 19:12
  • $\begingroup$ @CarlLange Great minds, and all that... :-) $\endgroup$
    – MarcoB
    Commented Jan 5, 2021 at 19:13
  • $\begingroup$ @MarcoB --- Terrific.....I don't even understand the answer I got yesterday, but I will...and now THIS one. It's simple, and easy. I appreciate it! I hope I can understand and do this on my own. $\endgroup$
    – fiz
    Commented Jan 5, 2021 at 19:34
  • 2
    $\begingroup$ Also, UnitConvert[PlanetData[PlanetData[], "Density", "EntityAssociation"], "SIBase"] $\endgroup$
    – Bob Hanlon
    Commented Jan 5, 2021 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.