Re: How to handle Units of Measure
- To: mathgroup at smc.vnet.net
- Subject: [mg100169] Re: [mg100143] How to handle Units of Measure
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 27 May 2009 04:05:53 -0400 (EDT)
- References: <2967287.1243330733384.JavaMail.root@n11>
Use the Units package that is listed in the Standard Extra Packages section of the Documentation Center. It is loaded with the following statement: Needs["Units`"] (You may also sometimes wish to use the Physical Constants package.) Then my recommendation is to never use units directly in symbolic equations but make them part of the data values and substitute these only at the conclusion of any symbolic manipulations you might do, such as solving symbolic equations. Solving equations that contain some units and/or data values is usually a mess. So, for example, define a set of data: data = {R -> 5 Ohm, w -> .25 Mega Hertz, L -> 5 Micro Henry}; Then you could use this in your expression, which just for fun I have converted to an equation, as follows: Z == R + I w L % /. data MapAt[Convert[#, Ohm] &, %, 2] giving Z == R + I L w Z == 1.25 I Henry Hertz Mega Micro + 5 Ohm Z == (5 + 1.25 I) Ohm The ExtendUnits6 package at my web site ($30) contains a number of features that make it more convenient to use units in physical problems: more convenient postfix form of conversion; ability to automatically pick prefix forms and keep them before the unit; ability to parse compatible descending units such as hours, minutes, seconds; ability to install new units or synonyms such as mph; ability to deunitize expressions to any specified implied set of compatible input and output units; ability to used reduced unit systems such as geometric units in particle physics, or atomic units where certain physical constants are set to 1; ability to convert approximate value degrees; and ability to convert any kind of decibel units. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Teodoro [mailto:jwheeler51 at gmail.com] In this very simple example if I write R+iwL where R is measured in Ohms, w in s^-1, L in H, I expect that the result is given in Ohms. Why it doesn't happen in Mathematica ? Ho can I do to handle in a simple way those conversions ? Thanks