use oddfun in integrals?



> integrate doesn't seem to know about odd functions.
> How about this? Define a pattern-matching rule to look
> for the integral of an odd function over a symmetric interval.

Thank you for this!

I was playing around a bit more with odd and even functions, and it 
seems that integrate cares about the _product_ of an odd and an even 
function!?  As in lines 1--5.

I left it at the attempt, to convince integrate to find the zero value 
by including a dummy-function h in the integrand, only locally declared 
to be even. (lines 6--10)

After the block, Maxima doesn't seem to know any feature about h, but 
still insists on the integral to evaluate to zero. - There may be a bug? 
(lines 11--15)

--Martin

(%i17) kill(all);
(%o0) done
(%i1) integrate(f(x), x,-a,a);
(%o1) integrate(f(x),x,-a,a)
(%i2) integrate(f(x)*g(x), x,-a,a);
(%o2) integrate(f(x)*g(x),x,-a,a)
(%i3) declare(
     g, evenfun,
     f, oddfun
);
(%o3) done
(%i4) integrate(f(x), x,-a,a);
(%o4) integrate(f(x),x,-a,a)
(%i5) integrate(f(x) * g(x), x,-a,a);
(%o5) 0


(%i6) integrand: f(x)*h(x);
(%o6) f(x)*h(x)
(%i7) integrate(integrand, x,-a,a);
(%o7) integrate(f(x)*h(x),x,-a,a)
(%i8) featurep(f, oddfun);
featurep(h, evenfun);
(%o8) true
(%o9) false
(%i10) block(
     local(h),
     print("f even? : ", featurep(f, oddfun)),
     print("h before: ", featurep(h, evenfun)),
     declare(h, evenfun),
     print("h after:  ", featurep(h, evenfun)),
     integrate(integrand, x, -a, a)
);
f even? : true
h before: false
h after:  true
(%o10) 0


(%i11) featurep(f, oddfun);
featurep(h, evenfun);
(%o11) true
(%o12) false
(%i13) integrate(integrand, x, -a,a);
(%o13) 0
(%i14) facts(f);
(%o14) [kind(f,oddfun)]
(%i15) facts(h);
(%o15) []