Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Chop?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23034] Re: Chop?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 13 Apr 2000 02:43:22 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8d0prj$4g9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

 what is with

$tiny = 1.0*10^(-5);
SetAttributes[myChop, Listable]

myChop[x_] := Module[{xx}, xx = Chop[x]; If[Abs[xx] < $tiny, 0., xx]]

It is not perfect, because it does not change expressions like
myFunction[0.00000006]
but I hope it helps for your vectors

Regards
  Jens

Russell Towle wrote:
> 
> 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


  • Prev by Date: Re: Speeding up Inverting matrices.
  • Next by Date: RE: Mesh
  • Previous by thread: Re: Chop?
  • Next by thread: Re: Chop?