Re: Question about Tally on a list of lists
- To: mathgroup at smc.vnet.net
- Subject: [mg99316] Re: Question about Tally on a list of lists
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 2 May 2009 06:01:55 -0400 (EDT)
On 5/1/09 at 5:23 AM, bleeckerj 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