Hi,

the same factorization can be computed using collect(), eg.:

In [1]: from sympy.abc import mu, gamma

In [2]: f = (- gamma * (x-mu)**2 - log(gamma) + log(2*pi)) / 2

In [3]: collect(f.expand(), x, evaluate=False)
Out[3]:
⎧                                                 2⎫
⎜ 2  -γ             log(2)   log(π)   log(γ)   γ*μ ⎟
⎨x : ──, x: γ*μ, 1: ────── + ────── - ────── - ────⎬
⎜    2                2        2        2       2  ⎟
⎩                                                  ⎭

In [4]: collect(f.expand(), mu, evaluate=False)
Out[4]:
⎧                                                 2⎫
⎜         2  -γ     log(2)   log(π)   log(γ)   γ*x ⎟
⎨μ: γ*x, μ : ──, 1: ────── + ────── - ────── - ────⎬
⎜            2        2        2        2       2  ⎟
⎩                                                  ⎭

In [5]: collect(f.expand(), [gamma, log(gamma)], evaluate=False)
Out[5]:
⎧                              2    2              ⎫
⎜   log(2)   log(π)           μ    x               ⎟
⎨1: ────── + ──────, γ: μ*x - ── - ──, log(γ): -1/2⎬
⎜     2        2              2    2               ⎟
⎩                                                  ⎭

Mateusz

2008/4/14, Ondrej Certik <[EMAIL PROTECTED]>:
>
>  On Mon, Apr 14, 2008 at 2:46 PM, [EMAIL PROTECTED]
>  <[EMAIL PROTECTED]> wrote:
>  >
>  >  Well at least now I feel productive in helping to improve sympy. How
>  >  long does it normally take to get this sort of thing fixed? I need to
>  >  decide whether to use maxima or sympy in the next few days. I
>  >  understand this may not be an easy to answer question though.
>
>
> If you submit a patch, it's fixed immedatelly, if not, then it
>  depends, but if this is the only problem you have with sympy, I'll try
>  to fix it today.
>
>  What are you going to use maxima/sympy for? What exact features do you
>  need? You may also consider Sage, that wraps maxima and you can use it
>  from python. However, I am not sure whether they wrapped maxima's
>  pattern matching.
>
>
>  Ondrej
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
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