Wolfram Research

Function Repository Resource:

FunctionParity

Source Notebook

Determine the parity of a function (whether it is even or odd) with respect to one or more variables

Contributed by: Wolfram|Alpha math team

ResourceFunction["FunctionParity"][expr,x]

gives an integer indicating the parity of expr with respect to x, or Undefined.

Details and Options

FunctionParity returns one of the following results:
-1 expr is an odd function of x
1 expr is an even function of x
0 expr is both an even and an odd function of x
Undefined none of the above is true
A function is considered even if f(x)=f(-x) for all x and is considered odd if -f(x)=f(-x).

Examples

Basic Examples

Find the parity of a basic power function:

In[1]:=
ResourceFunction["FunctionParity"][x^2, x]
Out[1]=


Test another power function:

In[2]:=
ResourceFunction["FunctionParity"][x^3, x]
Out[2]=

Show that a constant function has even parity:

In[3]:=
ResourceFunction["FunctionParity"][1, x]
Out[3]=

Find the parity of a rational function:

In[4]:=
ResourceFunction["FunctionParity"][x/(x^2 + 1), x]
Out[4]=

Find the parity of the absolute value function:

In[5]:=
ResourceFunction["FunctionParity"][Abs[x], x]
Out[5]=

Find the parity of a trigonometric function:

In[6]:=
ResourceFunction["FunctionParity"][Sin[x + Pi/4] + Cos[x + Pi/4], x]
Out[6]=

Find the parity of a gaussian function:

In[7]:=
ResourceFunction["FunctionParity"][Exp[-x^2], x]
Out[7]=

Test a signed gaussian function:

In[8]:=
ResourceFunction["FunctionParity"][Sign[x] Exp[-x^2], x]
Out[8]=


Find the parity of the hyperbolic tangent function:

In[9]:=
ResourceFunction["FunctionParity"][Tanh[x], x]
Out[9]=


Find the parity of the error function:

In[10]:=
ResourceFunction["FunctionParity"][Erf[x], x]
Out[10]=


Find the parity of a Fresnel integral:

In[11]:=
ResourceFunction["FunctionParity"][FresnelC[x], x]
Out[11]=


Find the parity of a shifted Fresnel integral:

In[12]:=
ResourceFunction["FunctionParity"][FresnelC[x] + 1, x]
Out[12]=

Scope


Show that an implicitly-defined circle is even in both x and y:

In[13]:=
ResourceFunction["FunctionParity"][x^2 + y^2, {x, y}]
Out[13]=

Find the parity of a function of two variables:

In[14]:=
ResourceFunction["FunctionParity"][Sinh[x + y], {x, y}]
Out[14]=

Find the parity of a function of three variables:

In[15]:=
ResourceFunction["FunctionParity"][Sin[x y z], {x, y, z}]
Out[15]=

Properties and Relations


FunctionParity returns Undefined for functions that are neither even nor odd:

In[16]:=
ResourceFunction["FunctionParity"][1 + x, x]
Out[16]=

The constant function f(x)=0 is both even and odd:

In[17]:=
ResourceFunction["FunctionParity"][0, x]
Out[17]=

Resource History

See Also

License Information