Student Support Forum: 'About counting elements' topicStudent Support Forum > General > Archives > "About counting elements"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response yehuda 01/24/13 05:00am In Response To 'Re: Re: About counting elements'---------This brings up the old question - 1. to count or not to count the missing elements 2. Another problems in the proposed solution is the use of minimal and maximal values known in advance 3. Third (maybe), the counting results are missing the value they counts So, if one decides in favor of counting also missing elements answering 2 for a predetermined range is as proposed before otherwise With[{l = {-6, 0, 0, 1, 1, 1, 2, 4, 4, 4, 4, 4, 5}}, Map[Count[l, #] &, Range[Min[l], Max[l]]]] answering 3 is rather simple too With[{l = {-6, 0, 0, 1, 1, 1, 2, 4, 4, 4, 4, 4, 5}}, Map[{#, Count[l, #]} &, Range[Min[l], Max[l]]]] and deciding to count only elements that do appear (guess what happens if the list is {-1,0,1,1000000} for example, generating a rather too long list as an answer Tally[{-6, 0, 0, 1, 1, 1, 2, 4, 4, 4, 4, 4, 5}] I hope this broadens (a little bit) the scope of both the question and the answer yehuda URL: ,

 Subject (listing for 'About counting elements') Author Date Posted About counting elements Matt 01/21/13 8:42pm Re: About counting elements Bill Simpson 01/22/13 9:35pm Re: Re: About counting elements Matt 01/23/13 4:04pm Re: Re: Re: About counting elements yehuda 01/24/13 05:00am Another question Matt 01/24/13 12:07pm Re: Another question yehuda 01/24/13 6:17pm Re: Another question Bill Simpson 01/24/13 10:59pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic