MathGroup Archive 2004

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

Search the Archive

Re: sorry, but more q's on random numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50537] Re: sorry, but more q's on random numbers
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Thu, 9 Sep 2004 05:18:40 -0400 (EDT)
  • References: <chmomi$a2a$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The general rule for transforming probability density functions is

Pr(x) = d(y)/d(x) Pr(y)

where x and y are vector-valued, Pr(x) and Pr(y) are the PDFs expressed in 
x-space and y-space, and d(y)/d(x) is the Jacobian of the transformation.

For your 1-dimensional problem this gives (assuming your range is a<=y<=b 
with a>0 to ensure you avoid the logarithmic singularity at y=0)

P(y) = 1/(b-a), a<=y<=b (and Pr(y)=0 otherwise)

x = log10(y) = ln(y)/ln(10) (using log10 to denote log base 10, and ln to 
denote natural log)

y = exp(x log(10)) = 10^x

d(y)/d(x) = 10^x ln(10)

Pr(x) = 10^x ln(10)/(b-a), log10(a)<=x<=log10(b) (and Pr(x)=0 otherwise)

Sanity check the result
Integrate[10^x Log[10]/(b - a), {x, Log[10, a], Log[10, b]}]

which gives 1 as required.

You can plot this using (for example)

With[{a=2,b=5},
    Plot[10^x 
Log[10]/(b-a),{x,Log[10,a],Log[10,b]},PlotRange\[Rule]{0,Automatic}]
    ];

or if you want to show the probability surrounding the region where it is 
non-zero you can use (for example)

f[x_,a_,b_]:=10^x 
Log[10]/(b-a)/;Log[10,a]\[LessEqual]x\[LessEqual]Log[10,b];
f[x_,a_,b_]:=0;

With[{a=2,b=5},
    Plot[f[x,a,b],{x,0,1},PlotRange\[Rule]{0,Automatic}]
    ];

Steve Luttrell

"sean kim" <sean_incali at yahoo.com> wrote in message 
news:chmomi$a2a$1 at smc.vnet.net...
> Hello Group,
>
> I hate to keep revisiting this, but if i may...
>
> What kind of distribution do I get if I take the base
> 10 Log of Random[Real, {range}]?
>
> is that Log Uniform? or normal?
>
> Sorry for such newbie question.
>
> also What's the best way to show what type of
> distribution it is?  I was thinking of listplot.
>
> thanks in advance for any insights.
>
> sean
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
> http://promotions.yahoo.com/new_mail
> 



  • Prev by Date: Re: How to solve a simple Trig cofunction?
  • Next by Date: Re: Exact real numbers
  • Previous by thread: Re: Re: sorry, but more q's on random numbers
  • Next by thread: How to solve a simple Trig cofunction?