MathGroup Archive 2008

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

Search the Archive

Re: tiny negative numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92878] Re: tiny negative numbers
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 16 Oct 2008 05:06:42 -0400 (EDT)

On 10/15/08 at 5:36 AM, arorahina at gmail.com (a) wrote:

>I am trying to solve a set of differential equations using NDSolve.
>But I'm seeing some really tiny negative numbers like this one:
>-1.28E-12. I'm guessing this is a machine-precision related problem.
>So I was wondering if I can somehow ensure that the variable values
>never go below 0, or alternatively, ensure that these tiny numbers
>equate to 0?

You can use Chop to force small numbers to 0. For example,

In[31]:= Chop[-1.28 10^-12]

Out[31]= 0

Larger values can be forced to zero with Chop by using the second argument.=
 For example,

In[33]:= Chop[.2, 1]

Out[33]= 0


  • Prev by Date: Re: What is the compatibility guide?
  • Next by Date: Re: parameters problem in FindFit
  • Previous by thread: Re: tiny negative numbers
  • Next by thread: Re: tiny negative numbers