       Re: rician random number

• To: mathgroup at smc.vnet.net
• Subject: [mg15211] Re: rician random number
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Tue, 22 Dec 1998 04:01:41 -0500
• Organization: University of Western Australia
• References: <754u82\$jdh@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Tomas Garza wrote:

> I suggest you use an approximate method based on an idea by Paul Abbott:

Two possible improvements to this idea.

 For the PDF

In:= PDF[A_, s_][r_] = (r/s^2*BesselI[0, (r*A)/s^2])/E^((A^2 +
r^2)/(2*s^2));

use NDSolve (and dynamic programming) instead of NIntegrate to determine
the CDF:

In:= CDF[A_, s_] := CDF[A, s] = Module[{y},
First[y /. NDSolve[{y'[r] == PDF[A, s][r], y == 0}, y, {r, 0,
10}]]]

 From the plot,

In:= cdfplot = Plot[CDF[1, 1][x], {x, 0, 10}, PlotRange -> All];

into Plot):

In:= pts = Cases[cdfplot, Line[{x__}] -> x, Infinity];

and then numerically compute the inverse function using interpolation:

In:= inverseCDF[1,1] = Interpolation[Reverse /@ pts]

In:= Table[inverseCDF[1,1][Random[]], {10}]

Cheers,
Paul

____________________________________________________________________
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907
mailto:paul at physics.uwa.edu.au  AUSTRALIA
http://www.physics.uwa.edu.au/~paul

God IS a weakly left-handed dice player
____________________________________________________________________

```

• Prev by Date: strange function that defines a function---how do I do it?
• Next by Date: Re: button to read in an external file
• Previous by thread: Re: Re: rician random number