Hot answers tagged


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.


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.


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. *) ...


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 {v,0,0....


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.


With version 9, this is now possible using this method: Plot[1/Sqrt[1 - v^2/QuantityMagnitude[UnitConvert[Quantity["SpeedOfLight"]]]^2], {v, 0,0.9*QuantityMagnitude[UnitConvert[Quantity["SpeedOfLight"]]] }]


ComplexExpand[Meter Nano Re[(a + I b)/(Meter Nano)]] a As a side note: in v9, the Miscellaneous`Units` package that you are using (and which you don't mention in your question) has been superseded by the new built-in unit system. The above expression would have been simplified without Simplify: Quantity[1, "Nanometers"]Re[Quantity[a + I*b, "...

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