On Mon, Apr 14, 2008 at 10:15 AM, Dan Gildea <gildea at pobox.com> wrote:
> OK. There was already a call to expand1 in the piargs code, which
> could cause it to take a long time (bug 1553866). Removing this
> call to expand causes the following test cases from rtest9a.mac to fail:
There is no bright line about what to do here. a+%pi should certainly
be recognized, as should a+%pi*k (where k is declared integer). I
would like to see a+%pi*(k+x) to be recognized, but cases like
a+(%pi+1)*(k+x) are probably mathematically uninteresting. Cases like
a+%pi*(k+x)*(k-x) could be recognized in principle as a + %pi*k^2 -
%pi*x^2, but again are probably not interesting in practice (and the
user can always do the expand himself), while a+%pi*(k+sin(x*%pi)) may
well be interesting (where the %pi is in a nested function).
In short, you don't necessarily want the remainder to be %pi-free,
just to extract cases of k/2*%pi where they are "near the surface".
-s