Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2824
| From | yitzhakbg <yitzhakbg@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Even and Odd functions |
| Date | 2011-05-31 11:48 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <is2ki5$qqa$1@smc.vnet.net> (permalink) |
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 comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Even and Odd functions yitzhakbg <yitzhakbg@gmail.com> - 2011-05-31 11:48 +0000
csiph-web