[sympy] Re: cos(x - y) == cos(y - x)

2009-05-30 Thread Aaron S. Meurer
(x-y).could_extract_minus_sign() is supposed to do this. According to the docstring "For any expression, the set {e.could_extract_minus_sign(), (-e).could_extract_minus_sign()} must be {True, False}." So, something like if expr.could_extract_minus_sign(): return -expr else: r

[sympy] Re: cos(x - y) == cos(y - x)

2009-05-29 Thread Fabian Pedregosa
Luke wrote: > It is late, but it seems to me that [2] should evaluate true, for any > x and y, not just real x and y. Should also work for functions. > > In [1]: cos(x - 1) == cos(1 - x) > Out[1]: True > > In [2]: cos(x - y) == cos(y - x) > Out[2]: False > > In [3]: x = Symbol('x', real=True)

[sympy] Re: cos(x - y) == cos(y - x)

2009-05-29 Thread Luke
Aaron was correct, it was late at night (or early in the morning). Ondrej, can you elaborate on what you mean by canonical form? Do you mean something should be done in cos.canonize? Currently canonize just call cls.eval(arg). I'm unclear why it works for 1 and x, i.e. cos(1-x)==cos(x-1), but

[sympy] Re: cos(x - y) == cos(y - x)

2009-05-29 Thread Aaron S. Meurer
On May 29, 2009, at 9:25 AM, Ondrej Certik wrote: > > On Fri, May 29, 2009 at 2:24 AM, Luke wrote: >> >> It is late, but it seems to me that [2] should evaluate true, for any > > Why is it late? I think because he sent it at 2:30 in the morning. Aaron Meurer --~--~-~--~~-

[sympy] Re: cos(x - y) == cos(y - x)

2009-05-29 Thread Ondrej Certik
On Fri, May 29, 2009 at 2:24 AM, Luke wrote: > > It is late, but it seems to me that [2] should evaluate true, for any Why is it late? > x and y, not just real x and y.  Should also work for functions. > > In [1]: cos(x - 1) == cos(1 - x) > Out[1]: True > > In [2]: cos(x - y) == cos(y - x) > Ou