MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can't make function periodic for t<0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119344] Re: Can't make function periodic for t<0
  • From: Yitzhak Bar Geva <yitzhakbg at gmail.com>
  • Date: Tue, 31 May 2011 07:47:43 -0400 (EDT)

Thanks again.
Any idea why the functions don't show as even or odd after applying makeper?
The Sin and Cos functions do show as odd and even, but not xx and yy (which
should according to the plots):


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};
fs
{#1 &, #1^3 &, Sin, Cos, xx, yy}
OddFunctionQ /@ fs
{True, True, True, False, False, False}
EvenFunctionQ /@ fs
{False, False, False, True, False, False}


Best,

Yitzhak



On Mon, May 30, 2011 at 7:16 PM, DrMajorBob <btreat1 at austin.rr.com> wrote:

> ClearAll[x, makeper]
> x[t_] := Piecewise[{{-1, -1/2 <= t < 0}, {1, 0 <= t < 1/2}}]
> makeper[f_, p_, d_][t_] := f[Mod[t, p, d]]
> Plot[x@t, {t, -5, 5}, PlotRange -> {-1, 1}]
> Plot[makeper[x, 1, -1/2]@t, {t, -5, 5}, PlotRange -> {-1, 1}]
>
> Plot[Cos@t, {t, -5, 5}, PlotRange -> {-1, 1}]
> Plot[makeper[Cos, 1, -1/2]@t, {t, -5, 5}, PlotRange -> {-1, 1}]
>
> Bobby
>
> On Mon, 30 May 2011 05:35:39 -0500, yitzhakbg <yitzhakbg at gmail.com> wrote:
>
>  This is the function to make periodic:
>> x[t_] := Piecewise[{{-1, -1/2 <= t < 0}, {1, 0 <= t < 1/2}}]
>>
>> I saw DH's lovely post from 1/14/09:
>> "if we want some function f to have period L we may define an operator:
>> makeper[f_,L_]= f[Mod[#,L]]&
>> Here is an example. We want a sine with period 1:
>> sin1= makeper[Sin,1]"
>> I can't get it to work for t<0 because Mod always returns positive values.
>> Can anyone kindly help?
>> Yitzhak
>>
>>
>
> --
> DrMajorBob at yahoo.com
>


  • Prev by Date: Re: Evaluation control in Compile[]
  • Next by Date: Re: Can Mathematica construct a set of equations?
  • Previous by thread: Re: Can't make function periodic for t<0
  • Next by thread: Re: sequential elements of list