Re: Getting rid of annoying zeroes in algebraic expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg15236] Re: Getting rid of annoying zeroes in algebraic expressions
- From: Harald Giese <giese at dkrz.de>
- Date: Sun, 27 Dec 1998 03:58:29 -0500
- Organization: Institut fuer Meereskunde, Universitaet Hamburg
- References: <75q1n1$23s@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Ross, Sean" wrote: > > Let xx be the result of some algebraic manipulations which, for some > reason, mathematica thinks the real zeroes ought to be kept and I think > they ought to be dropped. > > xx=0. + (a*f)/(0. + f) + (b*f)/(0. + f) + (c*f)/(0. + f) > > xx/.Plus[0.,q_]->q > > returns > > 0. + (a*f)/(0. + f) + (b*f)/(0. + f) + (c*f)/(0. + f) > > while > > 0. + (a*f)/(0. + f) + (b*f)/(0. + f) + (c*f)/(0. + f)/.Plus[0.,q_->q] > > returns the expected > > a+b+c. > ... Hi, Mathematica keeps the approximate zeros "0.", because it regards the symbols a, ..., f as expressions with indefinite precision. (See the Mathematica book: Section 3.1.4. for that topic.) Try xx /. {0. -> 0} or Chop[xx] -- Harald Giese Email: giese at dkrz.de Phone: +49 (0)40 4123 5796; Fax: +49 (0)40 5605724 Institut fuer Meereskunde der Universitaet Hamburg (Institute of Oceanography of the University of Hamburg) Troplowitzstrasse 7, D-22529 Hamburg