Newsgroups: comp.lang.apl
Path: watmath!watserv1!torn.onet.on.ca!utgpu!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!news.cs.indiana.edu!mips!darwin.sura.net!europa.asd.contel.com!uunet!decwrl!csus.edu!sfsuvax1.sfsu.edu!vpcsc4
From: vpcsc4@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Probability Convolutions
Message-ID: <1992May28.001443.1786@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Distribution: NA
Date: Thu, 28 May 1992 00:14:43 GMT
Lines: 27

I am writing a program to calculate the nth convolution for a p.d.f.
My question actually addresses looping (simple enough) and 
how to put all this stuff in one function.

If I define f1, f2, X, and P as :

  f1 =. ' +//. */~x.':11
  f2 =. ' +//. +/~x.':11
  Y =. 1 5 7
  P =. 0.1 0.2 0.7

Then each time the following three statements 
are typed I get a convolution for the p.d.f

  index =. /: Y =. f2 Y
  Y =. index { Y
  P =. index { f1 P

This function should execute these three comands n times.

Any suggestions on how I should write it?

-----
(Actually there is no need to sort at each interation
but later I plan to add some code to remove duplicate
values in the Y vector.)
en
