MathGroup Archive 2012

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

Search the Archive

Re: pattern matching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128321] Re: pattern matching
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 6 Oct 2012 01:53:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121005065207.DDFE768C4@smc.vnet.net>

http://reference.wolfram.com/mathematica/ref/PatternTest.html

Count[
 Table[
  Count[Table[RandomInteger[], {n}], 1]/n,
  {n, 100, 1000, 10}],
 x_?(# < .5 &)]

52


Bob Hanlon


On Fri, Oct 5, 2012 at 2:52 AM, Daniel Sanders <dnlsnd777 at gmail.com> wrote:
> Consider the following code:
>
> Count[Table[
>   Count[Table[RandomInteger[], {n}], 1]/n, {n, 100, 1000, 10}],
>  x_ < .5]
>
> I want to count the number of times there are occurrences less than .5 but some how I am not specifying the right pattern.  Any suggestions on getting right?
>



  • Prev by Date: Assuming and Integrate
  • Next by Date: Problem importing java class
  • Previous by thread: pattern matching
  • Next by thread: Re: pattern matching