evenfunc - Maple Help

type/evenfunc

check for an even function

type/oddfunc

check for an odd function

 Calling Sequence type(f, evenfunc(x)) type(f, oddfunc(x))

Parameters

 f - expression, regarded as a function of x x - name

Description

 • These procedures test the parity of the expression f, that is, whether it is even or odd, with respect to x.
 • More precisely, $\mathrm{type}\left(f\left(x\right),\mathrm{evenfunc}\left(x\right)\right)$ returns true if Maple can determine that $f\left(x\right)-f\left(-x\right)$ is zero and false otherwise.  Maple performs this test by calling Testzero on this difference. If false is returned, that is not a guarantee that f is not even: it may be zero, but if so, Testzero is not strong enough to recognize that the result is zero. Type $\mathrm{oddfunc}\left(x\right)$ is determined in a similar way but using the expression $f\left(x\right)+f\left(-x\right)$.

Examples

 > $\mathrm{type}\left({x}^{2},\mathrm{evenfunc}\left(x\right)\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left({x}^{2}{y}^{3}+2,\mathrm{evenfunc}\left(x\right)\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(\mathrm{sin}\left(x\right),\mathrm{oddfunc}\left(x\right)\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left(\frac{{x}^{2}}{x-1},\mathrm{oddfunc}\left(x\right)\right)$
 ${\mathrm{false}}$ (4)

In the following case, $f$ is even, but the default zero testing algorithm does not recognize this.

 > $f≔\mathrm{piecewise}\left(x=0,1,\frac{1}{{x}^{2}}\right)$
 ${f}{≔}\left\{\begin{array}{cc}{1}& {x}{=}{0}\\ \frac{{1}}{{{x}}^{{2}}}& {\mathrm{otherwise}}\end{array}\right\$ (5)
 > $\mathrm{type}\left(f,\mathrm{evenfunc}\left(x\right)\right)$
 ${\mathrm{false}}$ (6)

By changing the zero testing algorithm, we can make this return true. By default, Testzero calls Normalizer. In this case, we strengthen Normalizer.

 > $\mathrm{Normalizer}≔\mathrm{simplify}$
 ${\mathrm{Normalizer}}{≔}{\mathrm{simplify}}$ (7)
 > $\mathrm{type}\left(f,\mathrm{evenfunc}\left(x\right)\right)$
 ${\mathrm{true}}$ (8)