Re: test for "evenness" and "oddness"
- To: mathgroup at yoda.physics.unc.edu, gray at cmgroup.engr.wisc.edu
- Subject: Re: test for "evenness" and "oddness"
- From: jacobson at cello.hpl.hp.com
- Date: Mon, 25 Jan 93 09:11:56 -0800
Gary L. Gray asks
> I have a number of expression that are functions of some
> variable, say x. I would like to be able to test each of
> those functions to see whether they are odd or even in the
> variable x and then eliminate (maybe set to zero) those
> functions that are even. I have not been able to find a
> Mathematica function that will test for "evenness" or
> "oddness" with respect to a variable or variables. Does
How about this:
EvenFunctionQ[f_,var_] := TrueQ[Simplify[f - (f/. var -> -var)] == 0]
OddFunctionQ[f_,var_] := TrueQ[Simplify[f + (f/. var -> -var)] == 0]
Actually f is an expression, not a function. Var is the variable that
you want to test.
Here are some examples:
-- David Jacobson
Prev by Date:
Re: Exporting Mathematica output to word processing program
Next by Date:
EllipticTheta[3,real,Exp[I real] ]
Previous by thread:
test for "evenness" and "oddness"
Next by thread:
Re: Bug in x11ps (was: contour graphics)