Re: square wave function
- To: mathgroup at smc.vnet.net
- Subject: [mg31692] Re: [mg31663] square wave function
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Sat, 24 Nov 2001 16:44:09 -0500 (EST)
- References: <200111231046.FAA24071@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Yes. Perhaps you may try In[1]:= f[x_] := Mod[x, 2] - 1 Then look at In[2]:= Plot[Sign[f[x - 1]], {x, -10, 10}] Tomas Garza Mexico City ----- Original Message ----- From: "Peter Dimitriou" <peterangelo at mindspring.com> To: mathgroup at smc.vnet.net Subject: [mg31692] [mg31663] square wave function > To all who responded last time I posted, thank you, I was able to > resolve that on my own. > > My new Question deals with the following lines of Mathematica code: > > > Clear[square] > square[x_] := 1 /; 0<x<1 > square[x_] := -1 /; -1<x<0 > > Plot[square[x], {x,-1,1}] > > This defines and plots a square wave of period 2 between -1 and 1. > The question is how do I define this for all x (-inf<x<inf, with > period 2) in Mathematica? The Only hint I get is to consider using > the Mod function. Scratched my head long enough anyone out there > willing to help? > > Peter >
- References:
- square wave function
- From: peterangelo@mindspring.com (Peter Dimitriou)
- square wave function