You want factorization, not simplification:
In [1]: ax**2*vy**2 - 2*ax*ay*vx*vy + ay**2*vx**2
In [2]: factor(_)
Out[2]:
2
(ax⋅vy - ay⋅vx)
On 14 November 2012 14:30, Shriramana Sharma <[email protected]> wrote:
> Hello. I'm using SymPy 0.7.2 on Py3 and 0.7.1 on Py2, both on Kubuntu
> Precise. Please note below how simplify() is not able to take the
> square root of denom even though it is a perfect square. It wasn't
> even able to simplify the effect of expand(). Is this a known/unknown
> bug and should I report it? Thanks.
>
> In [1]: from sympy import *
>
> In [2]: var('d,ax,ay,vx,vy,a2,v2,denom')
> Out[2]: (d, ax, ay, vx, vy, a2, v2, denom)
>
> In [3]: d=ax*vx+ay*vy
>
> In [4]: v2=vx*vx+vy*vy
>
> In [5]: a2=ax*ax+ay*ay
>
> In [6]: denom=v2*a2-d*d
>
> In [7]: sqrt(denom)
> Out[7]: sqrt((ax**2 + ay**2)*(vx**2 + vy**2) - (ax*vx + ay*vy)**2)
>
> In [8]: simplify(sqrt(denom))
> Out[8]: sqrt(ax**2*vy**2 - 2*ax*ay*vx*vy + ay**2*vx**2)
>
> In [9]: sqrt(simplify(denom))
> Out[9]: sqrt(ax**2*vy**2 - 2*ax*ay*vx*vy + ay**2*vx**2)
>
> In [10]: (ax*vy-ay*vx)**2
> Out[10]: (ax*vy - ay*vx)**2
>
> In [11]: ((ax*vy-ay*vx)**2).expand()
> Out[11]: ax**2*vy**2 - 2*ax*ay*vx*vy + ay**2*vx**2
>
> In [12]: simplify(((ax*vy-ay*vx)**2).expand())
> Out[12]: ax**2*vy**2 - 2*ax*ay*vx*vy + ay**2*vx**2
>
> --
> Shriramana Sharma
>
> --
> 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.