I want to create the functions $even[f]$ and $odd[f]$ which will apply the formula $even[f(x)] = \frac{f(x)+f(-x)}{2}$ and $odd[f(x)]=\frac{f(x)-f(-x)}{2}$ for an arbitrary $f$.
I tried using
even[ff, x_] := (ff[x] + ff[-x])/2
But that doesn't seem to work. What would the correct approach to this be?
even[f_[x_]] := (f[x] + f[-x])/2andodd[f_[x_]] := (f[x] - f[-x])/2– RunnyKine Feb 18 '14 at 04:38In[29]:= even[f_[x_]] := (f[x] + f[-x])/2
In[30]:= f[x_] := x^2 + x
In[35]:= even[f] even[f[x]] even[f[x_]] even[f[#]]
Out[35]= even[f]
Out[36]= even[x + x^2]
Out[37]= even[x_ + x_^2]
Out[38]= even[#1 + #1^2]
– R R Feb 18 '14 at 05:12SetAttributeslike I did? – RunnyKine Feb 18 '14 at 05:23