Message Boards Message Boards

1
|
8162 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Remove the units from Physical Constants Package

Posted 10 years ago

In Physical Constants Package (I know it's obsolete now, still handy) when I call a constant and do some manipulations I am left with something that has units attached to it. How can I remove this units part leaving just the number? Thanks.

POSTED BY: Al Guy
2 Replies

The best choice to do what you want is by using the functions Quantity, UnitConvert and QuantityMagnitude.

UnitConvert@Quantity["ProtonMass"]
QuantityMagnitude@%

If you do not want or cannot use them for some reason, one possible way to get the numerical value from the measurement is by using Part or First.

Off[General::obspkg]
<< PhysicalConstants`

ProtonMass
%[[1]]
%% // First
Posted 10 years ago

Thanks, that works.

POSTED BY: Al Guy
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