Hi again,
I've submitted a pull request for this, adding the simplification to cos:
https://github.com/sympy/sympy/pull/572
It should be fairly quick to review if there's no objections to it.
Thanks!
Tomo
On Thu, Aug 18, 2011 at 6:58 PM, Aaron Meurer wrote:
> Yes, we already have functions w
Yes, we already have functions where this behavior should go. They're
called trigsimp() and combsimp(), respectively. And both are called
from the generic simplify().
And I generally agree that more advanced simplification should not
happen automatically. The question is where to draw the line.
Hi,
> Either make cos.eval() to it, or make trigsimp() do it. Don't do any
> of those other hacks you suggested. My vote goes for making cos.eval
> do it, but I wouldn't be averse to putting it in trigsimp() instead.
I think that at least there should be a powerful general "simplification"
func
Either make cos.eval() to it, or make trigsimp() do it. Don't do any
of those other hacks you suggested. My vote goes for making cos.eval
do it, but I wouldn't be averse to putting it in trigsimp() instead.
Aaron Meurer
On Wed, Aug 17, 2011 at 4:47 PM, Tomo Lazovich wrote:
> I don't know...I gu
I don't know...I guess I'm still on the fence about that. On the one hand,
getting the (-1)**n by default probably leads to easier simplifications in
whatever expressions you have. On the other hand, I'm sort of wary of losing
the expression I type in (in this case cos(pi*n)) as the default behavio
I don't see why you wouldn't want cos(pi*n) to return (-1)**n always
when n is known to be an integer. I would have found this behavior to
be very useful back when I took my introductory course on PDEs for
computing Fourier coefficients.
Aaron Meurer
On Wed, Aug 17, 2011 at 12:16 PM, Chris Smith
> cos(pi*n) = (-1)**n identity). The second is that cos is given an
> _eval_power method which knows about this special case. Both of them seem a
> bit hackish. I don't know if this specific problem represents some more
> general type of simplifications that could be added to trigsimp which we can
Hi Tom,
Thanks for the quick reply! Some responses below:
On Wed, Aug 17, 2011 at 12:36 PM, Tom Bachmann wrote:
> Hi,
>
> It is certainly possible to modify cos to return (-1)**n for argument pi*n,
> see functions/elementary/**trigonometric.py, the various eval() functions
> (in particular, of
Hi,
It is certainly possible to modify cos to return (-1)**n for argument
pi*n, see functions/elementary/trigonometric.py, the various eval()
functions (in particular, of course, the one of cos).
In fact I think code like this is already there, namely cos(2*pi*n)
evaluates to 1 already (and
Hi everyone,
In working with some of my new stuff in the quantum module, I've noticed
something interesting related to the sympy cosine function. I have an output
of an integral that involves a cos(pi*n)**2 term, where n is set to be an
integer. I know that this should be 1, but sympy carries it a
10 matches
Mail list logo