fourie package behavior



On Sept. 13, Edwin Woollett wrote

>foursin(..) calls a locally defined function
>called adefint(..), which, for this case,
>then calls ldefint(...) which is where this
>question is coming from:

It appears that foursin(..) and the other functions
which fourier calls all declare n as a local variable
and then have "assume( n > 0)" inside the block(..)
which leaks out to be a global assumption.

If we add the declaration that n is an integer,
fourier and foursin(..) appear to work without the
annoying questions.

(%i1) (display2d:false, facts() );
(%o1) []
(%i2) (declare(n, integer), facts() );
(%o2) [kind(n, integer)]
(%i3) ldefint(x*sin(n*x), x, 0, %pi);
Is  n  positive or negative?
p;
(%o3) -%pi*(-1)^n/n
(%i4) facts();
(%o4) [kind(n,integer)]
(%i5) (load(fourie), facts() );
(%o5) [kind(n,integer)]
(%i6) foursin( x, x, %pi);
(%t6) b[n] = -2*(-1)^n/n
(%o6) [%t6]
(%i7) facts();
(%o7) [kind(n,integer), n > 0]
/* ie., calling foursin(..) has made n>0
  a global assumption  and now ldefint 
asks no questions   */
(%i8) ldefint(x*sin(n*x),x,0,%pi);
(%o8) -%pi*(-1)^n/n
================
to use ldefint(..) for our integral,
we need to both declare(n,integer) and
assume(n > 0) to get our answer
without questions.

Ted Woollett