There is a discussion at https://github.com/sympy/sympy/pull/13943 but no
separate issue (yet).

On Jan 23, 2018 5:27 AM, "Shilpa Sangappa" <shilpa.sanga...@gmail.com>
wrote:

> Thanks Leonid, for pointing me to this issue. I will start looking into it.
> What is the issue id?
>
> With Regards,
> Shilpa.
>
> P.S.: I didn't get a notification of your reply to my e-mail. Is there any
> settings that I need to do?
>
> On Tuesday, January 23, 2018 at 12:04:50 AM UTC+5:30, Leonid Kovalev wrote:
>>
>> Thanks for your interest. An issue that recently came up in the
>> Probability module is sampling from a Poisson distribution
>> <https://en.wikipedia.org/wiki/Poisson_distribution>. It used to not
>> work at all, and now it does but the algorithm is not efficient when the
>> parameter lamda is large. For example:
>>
>> from sympy.stats import *
>> sample(Poisson('x', 1000))
>>
>> can take a while to return.
>>
>> Usually one can sample by generating a Uniform(0, 1) random number u, and
>> then apply the inverse of the cumulative distribution function (CDF) to u.
>> But there isn't a formula for the inverse of the of a Poisson random
>> variable. The current algorithm
>> <https://github.com/sympy/sympy/blob/master/sympy/stats/drv_types.py#L31> 
>> simply
>> goes over all integers looking for the first one where CDF(n) >= u. There
>> ought to be a better way of doing this.
>>
>> The first idea that comes to mind is to make giant steps (in power of 2)
>> until CDF(n) >= u is reached, and then refine by bisection. But perhaps
>> it's better to do research first, there is probably an algorithm out there
>> that we can use. Maybe R has it? https://www.r-project.org/
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/sympy/0cb65d20-5126-4387-8aa4-f2e5ec1b82cc%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/0cb65d20-5126-4387-8aa4-f2e5ec1b82cc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAJ0_tQ%2Bbv5Yv2NL4pgT6d3wCSCsvwJQb8CW4bzTFZpd%3DTN7FiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to