Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2824 > unrolled thread
| Started by | yitzhakbg <yitzhakbg@gmail.com> |
|---|---|
| First post | 2011-05-31 11:48 +0000 |
| Last post | 2011-05-31 11:48 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Even and Odd functions yitzhakbg <yitzhakbg@gmail.com> - 2011-05-31 11:48 +0000
| From | yitzhakbg <yitzhakbg@gmail.com> |
|---|---|
| Date | 2011-05-31 11:48 +0000 |
| Subject | Even and Odd functions |
| Message-ID | <is2ki5$qqa$1@smc.vnet.net> |
Applying makeper makes the piecewise functions x and y periodic, yet they don't appear as even and odd functions whereas the Sin and Cos functions do show as odd and even.
xx and yy are the functions which fail the even/odd test yet show as even and odd according to the plots.
I couldn't determine why. Help appreciated.
ClearAll[x, y, xx, yy, makeper]
x[t_] := Piecewise[{{-1, -1/2 <= t < 0}, {1, 0 <= t < 1/2}}]
y[t_] := Piecewise[{{-t - 1/4, -1/2 <= t < 0}, {t - 1/4, 0 <= t < 1/2}}]
makeper[f_, p_, d_][t_] := f[Mod[t, p, d]]
(* Plot[x@t,{t,-5,5},PlotRange->{-1,1}] *)
xx[t_] := makeper[x, 1, -1/2]@t
yy[t_] := makeper[y, 1, -1/2]@t
Plot[xx[t], {t, -5, 5}, PlotRange -> {-1, 1}]
Plot[yy[t], {t, -5, 5}, PlotRange -> {-1, 1}]
OddFunctionQ[f_] := Module[{x}, f[x] + f[-x] === 0]
EvenFunctionQ[f_] := Module[{x}, f[x] - f[-x] === 0]
fs = {# &, #^3 &, Sin, Cos, xx, yy}
OddFunctionQ /@ fs
{True, True, True, False, False, False}
EvenFunctionQ /@ fs
{False, False, False, True, False, False}
Best,
Yitzhak
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web