Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Random Numbers
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John O'Neill  
View profile  
 More options Oct 24 2012, 5:38 pm
Newsgroups: comp.lang.idl-pvwave
From: "John O'Neill" <j1701j...@gmail.com>
Date: Wed, 24 Oct 2012 14:38:34 -0700 (PDT)
Local: Wed, Oct 24 2012 5:38 pm
Subject: Random Numbers
Hello Everyone,

I am trying to create a set of random numbers using an Inverse Gaussian Distribution (Wald distribution) but randomu doesn't seem able to do this.  Is there anything more general then randomu, or something where I can define what function I want to use to create random numbers?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Craig Markwardt  
View profile  
 More options Oct 24 2012, 7:34 pm
Newsgroups: comp.lang.idl-pvwave
From: Craig Markwardt <craig.markwa...@gmail.com>
Date: Wed, 24 Oct 2012 16:34:39 -0700 (PDT)
Local: Wed, Oct 24 2012 7:34 pm
Subject: Re: Random Numbers

On Wednesday, October 24, 2012 5:38:34 PM UTC-4, John O'Neill wrote:
> Hello Everyone,

> I am trying to create a set of random numbers using an Inverse Gaussian Distribution (Wald distribution) but randomu doesn't seem able to do this.  Is there anything more general then randomu, or something where I can define what function I want to use to create random numbers?

http://en.wikipedia.org/wiki/Inverse_transform_sampling

I'm not aware of any IDL routines to do this though, but it's not hard with a little integrating and interpolating.

The difficulty of implementing the method depends on the distribution to some degree.  For example, power law distributions can be hard to do because of the dynamic range required.

Craig


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yngvar Larsen  
View profile  
 More options Oct 25 2012, 3:14 am
Newsgroups: comp.lang.idl-pvwave
From: Yngvar Larsen <larsen.yng...@gmail.com>
Date: Thu, 25 Oct 2012 00:14:15 -0700 (PDT)
Local: Thurs, Oct 25 2012 3:14 am
Subject: Re: Random Numbers

On Wednesday, 24 October 2012 23:38:34 UTC+2, John O'Neill  wrote:
> Hello Everyone,

> I am trying to create a set of random numbers using an Inverse Gaussian Distribution (Wald distribution) but randomu doesn't seem able to do this.  Is there anything more general then randomu, or something where I can define what function I want to use to create random numbers?

Google and Wikipedia are your friends.

http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution#Generating...

IDL> N = 100
IDL> mu = 1d0 & lambda = 1d0
IDL> nu = randomn(seed, N)
IDL> z = randomu(seed, N)
IDL> igvariates = dblarr(N)
IDL> y = nu^2
IDL> x = mu + mu^2*y/(2*lambda) - mu/2/lambda*sqrt(4*mu*lambda*y + mu^2*y^2)
IDL> ind = where(z le mu/(mu+x), complement=cind)                          
IDL> igvariates[ind] = x[ind]
IDL> igvariates[cind] = mu^2/x[cind]

Include checking for empty index arrays IND and/or CIND if you use IDL version < 8.0.

--
Yngvar


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David  
View profile  
 More options Oct 25 2012, 10:37 am
Newsgroups: comp.lang.idl-pvwave
From: David <n...@idlcoyote.com>
Date: Thu, 25 Oct 2012 08:37:59 -0600
Local: Thurs, Oct 25 2012 10:37 am
Subject: Re: Random Numbers

This code is easy enough to implement that I just wrote
a function, cgRandomWald to do it this morning. You can
find it here:

   http://www.idlcoyote.com/programs/cgrandomwald.pro

It works very much like the other RandomX functions in IDL.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John O'Neill  
View profile  
 More options Oct 25 2012, 11:06 am
Newsgroups: comp.lang.idl-pvwave
From: "John O'Neill" <j1701j...@gmail.com>
Date: Thu, 25 Oct 2012 08:06:46 -0700 (PDT)
Local: Thurs, Oct 25 2012 11:06 am
Subject: Re: Random Numbers

Thank you very much David, Yngvar, and Craig for your help.  This is exactly what I was looking for.

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »