Re: Use of units and simplification
- To: mathgroup at smc.vnet.net
- Subject: [mg38912] Re: Use of units and simplification
- From: Bill Rowe <listuser at earthlink.net>
- Date: Sat, 18 Jan 2003 00:39:01 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 1/17/03 at 5:39 AM, yk at despammed.com (Yves K.) wrote: >1) Why does Simplify[Sqrt[x*Meter^2]] give Sqrt[Meter^2*x] ? The >result of the simplification is o.k. when I assume that Meter>=0: >Simplify[Sqrt[x*Meter^2], Meter >= 0] ->Meter*Sqrt[x] Mathematica treats the units as simply another symbol which does not have an assigned value. Mathematica does not simplify Sqrt[x^2] to x since there is no way to know which branch is desired. There are a couple of ways around this. Instead of Simplify you could use PowerExpand as in PowerExpand[Sqrt[x Meter^2]] or Sqrt[x Meter^2]//PowerExpand. However, Mathematica outputs Meter Sqrt[x] probably not exactly what you want. A better choice would be to use Ted Ersek's Units2.m package that can be found on the Mathsource site. Alternatively, David Park as written a units package that extends the package in the standard distribution. David's package offers a different feature set than Ted's. For my use, I prefer Ted's package. >2) There is Meter and Centimeter predefined. Where have the >Millimeters gone? I did not succeed in prepending any of the SI unit >prefixes. Could I simply use MilliMeter? Did not really work for me... Millimeter is there but needs to be expressed as Milli Meter (note the space). The units package predefines basic units in both the SI and CGS systems. Other units are expressed as by using the appropriate pre-fix in front of the basic unit. Millimeter is a derived unit in both the CGS and SI systems so is not pre-defined in the same way as Centimeter.