inconsistent treatment of cosine zero

34 views
Skip to first unread message

Bill McLean

unread,
Oct 18, 2015, 11:32:27 PM10/18/15
to sympy
This behaviour seems strange.  The case k=0 is handled correctly when integrating cos(k*x), but not cos(k*pi*x).

In [1]: integrate(cos(k*x),(x,0,pi))
Out[1]:
⎧π  for k = 0
⎨           
⎩0  otherwise

In [2]: integrate(cos(k*pi*x),(x,0,1))
Out[2]: 0

Aaron Meurer

unread,
Oct 19, 2015, 12:15:56 PM10/19/15
to sy...@googlegroups.com
For me they both give Piecewise results in SymPy 0.7.6.1.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/776993e9-96f6-4ec0-a3cf-816951bb7658%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Bill McLean

unread,
Oct 19, 2015, 8:53:42 PM10/19/15
to sympy
OK.  I should have mentioned that I am running SymPy 0.7.4.1.

Aaron Meurer

unread,
Oct 19, 2015, 9:05:26 PM10/19/15
to sy...@googlegroups.com
Looks like it's a bug that's been fixed since then. I recommend
upgrading if you can.

For reference, integrate() uses several different integration
algorithms, so you can end up getting different looking results
depending on which algorithm ends up being used (even in the latest
version). I believe the latest version has the logic for splitting out
cases into Piecewise expressions applied to most if not all of the
algorithms, though.

Aaron Meurer

On Mon, Oct 19, 2015 at 7:33 PM, Bill McLean <naelc...@gmail.com> wrote:
> OK. I should have mentioned that I am running SymPy 0.7.4.1.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/28cdc9de-3369-4d9f-a134-7ddfb654d9f0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages