From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/55420 Path: news.gmane.org!not-for-mail From: David Arnold Newsgroups: gmane.comp.tex.context Subject: Re: Random numbers in metapost Date: Thu, 31 Dec 2009 10:17:02 -0800 Message-ID: References: <4B3CA38B.7060602@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: multipart/mixed; boundary="===============1013308505==" X-Trace: ger.gmane.org 1262283475 1738 80.91.229.12 (31 Dec 2009 18:17:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2009 18:17:55 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Dec 31 19:17:47 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1NQPaS-0002l7-Og for gctc-ntg-context-518@m.gmane.org; Thu, 31 Dec 2009 19:17:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 17299C9C24; Thu, 31 Dec 2009 19:17:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Wo-XMaEWbfww; Thu, 31 Dec 2009 19:17:21 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3BCA1C9BFF; Thu, 31 Dec 2009 19:17:21 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 455F6C9BFF for ; Thu, 31 Dec 2009 19:17:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id in7dyMfBOLy5 for ; Thu, 31 Dec 2009 19:17:05 +0100 (CET) Original-Received: from omta02.suddenlink.net (omta02-pub.suddenlink.net [208.180.40.74]) by balder.ntg.nl (Postfix) with ESMTP id C94FCC9BE2 for ; Thu, 31 Dec 2009 19:17:04 +0100 (CET) Original-Received: from [10.0.1.6] (really [75.111.18.179]) by omta02.suddenlink.net (InterMail vM.7.09.02.04 201-2219-117-106-20090629) with ESMTP id <20091231181703.BGBI20778.omta02.suddenlink.net@[10.0.1.6]> for ; Thu, 31 Dec 2009 12:17:03 -0600 In-Reply-To: <4B3CA38B.7060602@elvenkind.com> X-Mailer: Apple Mail (2.1077) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:55420 Archived-At: --===============1013308505== Content-Type: multipart/alternative; boundary=Apple-Mail-20-508380982 --Apple-Mail-20-508380982 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Taco et al, I think I've found a way. Anthony Phan has written a brilliant stats = package for Metapost. http://www-math.univ-poitiers.fr/~phan/statsmac.html I think (haven't tried yet) I can select a number at random from the = uniform distribution on [0,1], then use one of Anthony's functions such = as: poissonicdf(expr p, lambda). Inverse cumulative distribution function of = P(lambda). See Anthony's manual at: http://www-math.univ-poitiers.fr/~phan/downloads/metapost/statsman.pdf David. On Dec 31, 2009, at 5:13 AM, Taco Hoekwater wrote: > David Arnold wrote: >> Hi, >> Does anyone have any strategies for drawing random numbers from >> various statistics distributions in Metapost? For example, say, >> drawing 100 random numbers from a beta distribution? >=20 > Assuming you are using mkiv: create a lua function and use its > calculated results to create the metapost code. Metapost only knows > about uniformdeviate and normaldeviate, and metapost is not a good > language to program mathematics in. >=20 > Best wishes, > Taco > = __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry = to the Wiki! >=20 > maillist : ntg-context@ntg.nl / = http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > = __________________________________________________________________________= _________ --Apple-Mail-20-508380982 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Taco = et al,

I think I've found a way. Anthony Phan has = written a brilliant stats package for = Metapost.


I = think (haven't tried yet) I can select a number at random from the = uniform distribution on [0,1], then use one of Anthony's functions such = as:

poissonicdf(expr p, lambda). = Inverse cumulative distribution function of P(lambda).
http://www-math.univ-poitiers.fr/~phan/downloads/metapost/statsman.p= df

David.


=
On Dec 31, 2009, at 5:13 AM, Taco Hoekwater wrote:

David = Arnold wrote:
Hi,
Does anyone have any strategies for drawing random = numbers from
various = statistics distributions in Metapost? For example, = say,
drawing 100 random = numbers from a beta distribution?

Assuming you are = using mkiv: create a lua function and use its
calculated results to = create the metapost code. Metapost only knows
about uniformdeviate = and normaldeviate, and metapost is not a good
language to program = mathematics in.

Best = wishes,
Taco
_______________________________________________________= ____________________________
If your question is of interest to = others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/= mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive =  : http://foundry.sup= elec.fr/projects/contextrev/
wiki     : http://contextgarden.net
________= __________________________________________________________________________= _

= --Apple-Mail-20-508380982-- --===============1013308505== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1013308505==--