On Fri, Nov 18, 2011 at 4:19 PM, Aaron Meurer <[email protected]> wrote:
> On Fri, Nov 18, 2011 at 3:40 PM, Matthew Rocklin <[email protected]> wrote:
>> It would be feasible to implement a system that can solve some problems.
>> However, there are a number of other tasks that have higher payoff/cost
>> ratios (getting it merged into master a clear example). I don't personally
>> plan to work on the infinite issue in the near future.
>> However, the first step to this has nothing to do with sympy-stats and could
>> be accomplished by any motivated member of this community (if indeed it is
>> feasible). Every random variable implementation depends on a well-separated
>> backend. Finite RVs depend on sets and iterators, Continuous RV's depend on
>> integrals, Multivariate on Matrix Exprs.  Infinite RVs would require a
>> strong sequences and series module. A simple example problem might be the
>> following
>> \sum_{i=0}^n\sum_{j=0}^i e^{-\lambda_1 i - \la happymbda_2 j}
>> If a module was produced which could solve many problems like the above then
>> it would easy for me to create an infinite discrete random variable object.
>> The stronger the ability of this module, the broader the class of random
>> expressions it could solve. My belief is that problems like the above are
>> difficult to solve analytically and that the potential use of infinite
>> random variables is relatively small. I'd be thrilled to learn that this
>> belief was incorrect.
>> -Matt
>
> The computation is definitely doable.  See
> http://www.wolframalpha.com/input/?_=1321658163860&i=sum(sum(exp(-l_1*i+-+l_2*j)%2c+j%3d0..i)+i%3d0..n)&fp=1&incTime=true.
>
> In fact, SymPy would be able to do it, if it could recognize
> exp(-lambda_1*i) as exp(-lambda_1)**i:

I created http://code.google.com/p/sympy/issues/detail?id=2854 for this.

Aaron Meurer

>
> In [79]: summation(x**-i*y**-j, (j, 0, i), (i, 0, n))
> Out[79]:
>    -n - 1         -n  -n ⎛   n    n    ⎞
>  - x       + 1    x  ⋅y  ⋅⎝x⋅x ⋅y⋅y  - 1⎠
> ─────────────── - ───────────────────────
> ⎛    1⎞ ⎛    1⎞      (y - 1)⋅(x⋅y - 1)
> ⎜1 - ─⎟⋅⎜1 - ─⎟
> ⎝    x⎠ ⎝    y⎠
>
> There are actually very strong algorithms for computing symbolic
> summations, just as there are algorithms for computing symbolic
> (indefinite) integrals. Unfortunately, they are just as difficult to
> implement.  But many of them are already implemented in SymPy, as you
> can see from the above.
>
> Aaron Meurer
>
>>
>>
>> On Fri, Nov 18, 2011 at 3:26 PM, Aaron Meurer <[email protected]> wrote:
>>>
>>> On Fri, Nov 18, 2011 at 2:19 PM, Matthew Rocklin <[email protected]>
>>> wrote:
>>> > Yes. Discrete random variables in full generality (i.e. both finite and
>>> > infinite cases) have not been implemented. There is, for example, no
>>> > Poisson
>>> > random variable.
>>> > When I looked into writing infinite sets and infinite discrete random
>>> > variables I came to the conclusion that solving this problem in full
>>> > generality was very difficult/impossible. An implementation to solve
>>> > uni-variate infinite RV problems is feasible but when you start mixing
>>> > multiple variables (i.e. conditions on both chickens and pigs) them you
>>> > quickly produce provably difficult problems.
>>> > Sorry for the thread hijack.
>>>
>>> Can you at least give an algorithm that uses steps that can be done at
>>> least some of the time.  For example, if a step is "solve this system
>>> of equations," then obviously sometimes you won't be albe to do it,
>>> but you can at least some of the time, and for those cases, it would
>>> be useful to get the solution.
>>>
>>> Or is it more complicated than that?
>>>
>>> Aaron Meurer
>>>
>>> >
>>> > On Fri, Nov 18, 2011 at 12:59 PM, Aaron Meurer <[email protected]>
>>> > wrote:
>>> >>
>>> >> On Fri, Nov 18, 2011 at 10:29 AM, Matthew Rocklin <[email protected]>
>>> >> wrote:
>>> >> >> This is a neat example.  Does this first one also just use for
>>> >> >> loops,
>>> >> >> or does it solve the equations?
>>> >> >>
>>> >> >> Aaron Meurer
>>> >> >>
>>> >> >
>>> >> > The finite random variable code is just a syntactically nice way to
>>> >> > set
>>> >> > up
>>> >> > and go though large iterators asking questions. It's not
>>> >> > computationally
>>> >> > clever in any way.
>>> >> >
>>> >>
>>> >> I see. So it would not be possible to extend the result to an infinite
>>> >> set (which hopefully has a finite solution).  In other words, you have
>>> >> to know ahead of time how many sides to put on your Die.
>>> >>
>>> >> Aaron Meurer
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "sympy" group.
>>> >> To post to this group, send email to [email protected].
>>> >> To unsubscribe from this group, send email to
>>> >> [email protected].
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/sympy?hl=en.
>>> >>
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "sympy" group.
>>> > To post to this group, send email to [email protected].
>>> > To unsubscribe from this group, send email to
>>> > [email protected].
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/sympy?hl=en.
>>> >
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "sympy" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/sympy?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to