Tag Info

Hot answers tagged

11

As J.M. comments, but opts not to post as an answer, you can use Convert in the Units package to convert between types. Be sure to read the documentation on that package. Needs["Units`"] Convert[(32.5 Newton)/(7 Meter/Second^2), Kilogram] 4.64286 Kilogram You will also find use in the Automatic Units package described on the Wolfram Blog.


8

The units associated with physical constants do not play nicely with expressions that expect a numerical value. If you want only the numerical value of a constant, use Part. A motivating example: Needs["PhysicalConstants`"]; Plot[1/Sqrt[1 - v^2/SpeedOfLight^2], {v, 0, 0.9 SpeedOfLight}] (* Plot::plln: Limiting value (2.69813*10^8 Meter)/Second in ...


8

What you're seeing here is just the impreciseness of floating point arithmetic. It is important to remember that floating point operations are not associative or distributive even if the underlying mathematical operations are. A very simple example demonstrating the lack of associativity: 1. + (1.*^20 - 1.*^20) (* 1. *) (1. + 1.*^20) - 1.*^20 (* 0. *) ...


5

In v. 9, speed of light is a quantity. Try Quantity["SpeedOfLight"] The output will look like the following: 1 c However, its FullForm is actually Quantity[1, "SpeedOfLight"] You will find addition information about how to use physical constants as quantities in the Compatibility Tutorial and in the Units Overview.


2

You can use SetPrecision to set the interpreted precision of a numeric value, or Rationalize to convert it into an exact value. Be cautious about manufacturing false precision.



Only top voted, non community-wiki answers of a minimum length are eligible