MathGroup Archive 2009

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

Search the Archive

Re: Question about Tally on a list of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99356] Re: Question about Tally on a list of lists
  • From: bleeckerj <bleeckerj at gmail.com>
  • Date: Sun, 3 May 2009 05:24:44 -0400 (EDT)
  • References: <gth5lg$f3m$1@smc.vnet.net>

On May 2, 3:01 am, Bill Rowe <readn... at sbcglobal.net> wrote:
> On 5/1/09 at 5:23 AM, bleeck... at gmail.com (bleeckerj) wrote:
>
> >Alternatively, I'd even be happy to somehow reduce the precision of
> >the numbers in the list, but after a few hours . I have not been
> >able to figure out how to coax Mathematica to somehow truncate the
> >numbers down to, say, 4 digits after the decimal point. This would
> >create a kind of artificial Bin'ing of the data, which would be fine
> >for my purposes. Removing the accuracy would allow me to effectively
> >turn the data into a checkerboard of "hits."
>
> Truncation to 4 digits after the decimal point can be
> accomplished using Floor. For example,
>
> In[7]:= x = RandomReal[]
>
> Out[7]= 0.623211
>
> In[8]:= Floor[x, .0001]
>
> Out[8]= 0.6232
>
> Here, I have assume a positive value and taken your "truncation"
> literally. For negative values, you would need to use Ceiling
> instead of Floor to achieve the same truncation. Quite possibly
> it would be better to use Round in place of Floor. For example,
>
> In[10]:= x = RandomReal[]
>
> Out[10]= 0.713353
>
> In[11]:= Round[x, .0001]
>
> Out[11]= 0.7134

Thanks for the tip Bill! Sorry for the obvious question =96 I'm still
getting used to Mathematica's idioms...

Julian


  • Prev by Date: Re: Introducing the Wolfram Mathematica Tutorial Collection
  • Next by Date: Re: Re: Introducing the Wolfram Mathematica Tutorial Collection
  • Previous by thread: Re: Question about Tally on a list of lists
  • Next by thread: mathematica newbie trouble