Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

newbie is looking for a customDistribution function

  • To: mathgroup at
  • Subject: [mg50383] newbie is looking for a customDistribution function
  • From: János <janos.lobb at>
  • Date: Wed, 1 Sep 2004 01:49:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


I looked for it in the archives, but found none.  I am looking for ways  
to create a custom distribution, which I can call as a function.  Here  
is an example for illustration.  Let's say I have a list created from a  
4 elements alphabet  {a,b,c,d}:



Distribute gives me - thanks David Park - all the two element  
combinations of {a,b,c,d}



I can count the occurrence of an element of twocombs in lst with the  
following function:

occuranceCount[x_List] := Count[Partition[lst, 2, 1], x]

Mapping this function over twocombs gives me the number of occurances  
of elements of twocombs in lst:



It shows that for example {c,a} occurs twice, {d,a} occurs once and  
{d,c} or {d,d} never occur.

Now, I would like to create a distribution function called  
twocombsLstDistribution which I could call and it would give me back  
elements of twocombs with the probability as they occur in distro, that  
is for on average I would get twice as much {c,a}s as {d,a}s and never  
get {d.c} or {d,d}.

How can I craft that ?

/Of course I need it for an arbitrary but finite length string lst over  
a fixed length alphabet {a,b,c,d,....} for k-length elements of kcombs,  
and it has to be super fast  :).  My real lst is between 30,000 and  
70,000 element long over a four element alphabet and I am looking for k  
between 5 and a few hundred. /

Thanks ahead,
People never lie so much as after a
hunt, during a war or before an election
- Otto von Bismarck -

  • Prev by Date: Re: mathlink newbie q
  • Next by Date: Re: Re: Re: Beware of NSolve - nastier example
  • Previous by thread: Re: Re: mathlink newbie q
  • Next by thread: Re: newbie is looking for a customDistribution function