On 16.09.2016 08:44, Darrell Leong wrote:
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <4c588db9-013c-4a85-b45a-10ea164467c8@k30g2000vbn.googlegroups.com>...
>> You have to invert the function. Integrate your function analytically
>> (if possible) so that it gives the CDF (y) as a function of your input
>> (x). Then try to invert it analytically so that you get x as an
>> output once you put in the CDF value (the y value) as an input.
>> *This* is the function you want to send your rand() array into.
>
> Now what can I do if the CDF cannot be integrated analytically? i.e. PDF:
> f(x)=exp((cos(x)-A)^2 + Bsin^2 (x))
For continuous distribution use acceptance-rejection method
https://en.wikipedia.org/wiki/Rejection_sampling
You have to guess a easier distribution g(x) that is similar,
but there exist a M that f(x)<=M*g(x)
The closer the two function are, the more effective the method is.
bartekltg
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <4c588db9-013c-4a85-b45a-10ea164467c8@k30g2000vbn.googlegroups.com>...
>> You have to invert the function. Integrate your function analytically
>> (if possible) so that it gives the CDF (y) as a function of your input
>> (x). Then try to invert it analytically so that you get x as an
>> output once you put in the CDF value (the y value) as an input.
>> *This* is the function you want to send your rand() array into.
>
> Now what can I do if the CDF cannot be integrated analytically? i.e. PDF:
> f(x)=exp((cos(x)-A)^2 + Bsin^2 (x))
For continuous distribution use acceptance-rejection method
https://en.wikipedia.org/wiki/Rejection_sampling
You have to guess a easier distribution g(x) that is similar,
but there exist a M that f(x)<=M*g(x)
The closer the two function are, the more effective the method is.
bartekltg