Re: Chop?
- To: mathgroup at smc.vnet.net
- Subject: [mg23043] Re: Chop?
- From: "Kevin J. McCann" <kevin.mccann at jhuapl.edu>
- Date: Thu, 13 Apr 2000 02:43:28 -0400 (EDT)
- Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
- References: <8d0prj$4g9@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Check the documentation on Chop, but here is an example
lst = Table[N[10^n], {n, 0, -20, -1}]
Chop[lst]
Chop[lst,0.01]
The first Chop uses the default and zeroes anything with absolute value less
than 10^-10. The additional option zeroes things with absolute values less
than 0.01. Note that Chop will not do anything to an exact like
1/100000000000 even though it is less than 10^-10.
Kevin
--
Kevin J. McCann
Johns Hopkins University APL
Johns Hopkins Road
Laurel MD 20723-6099
Russell Towle <rustybel at foothill.net> wrote in message
news:8d0prj$4g9 at smc.vnet.net...
> Hi,
>
> I have been noticing lately that sometimes Chop does not succeed in
> reducing numbers close to 0 to 0. Although my email program scrambled the
> superscripts, those '-7's down there are from the 10^-7's where I would
> expect (and would want) to see plain 0. Mathematica version 4.01 on a Mac.
Copied
> as plain text from OutputForm.
>
> This failure of Chop has ruined one of my most important algorithms, which
> takes the Union of a list of n-vectors. It has wrecked in turn my most
> important notebooks. Notice, if you will, members 5 and 6 of the list
> below, where the z component should have Chopped to zero, but instead is
> two very small numbers of opposite sign.
>
> In[221]:=
> Chop[q2]
>
> Out[221]=
> {{-0.707107, -1., 0}, {-0.707107, 0, -1.}, {-0.707107, 0, 1.}, {-0.707107,
> 1., 0},
>
> -7 -7
> {-0.707107, -1., -1.11022 10 }, {-0.707107, -1., 1.11022 10 },
>
> -7 -7
> {-0.707107, 1.11022 10 , -1.}, {-0.707107, 1., 1.11022 10 },
> {-0.707107, -1., 0},
>
> {-0.707107, 0, -1.}, {-0.707107, 0, 1.}, {-0.707107, 1., 0}, {0.707107,
> -1., 0},
>
> {0.707107, 0, -1.}, {0.707107, 0, 1.}, {0.707107, 1., 0},
>
> -7 -7
> {0.707107, -1., -1.11022 10 }, {0.707107, -1., 1.11022 10 },
>
> -7 -7
> {0.707107, 1.11022 10 , -1.}, {0.707107, 1., 1.11022 10 }}
>
> Russell Towle
> Box 141
> Dutch Flat, CA 95714
> (530) 389-2872
>
>
>