MathGroup Archive 2001

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

Search the Archive

RE: square wave function

  • To: mathgroup at
  • Subject: [mg31680] RE: [mg31663] square wave function
  • From: "Ingolf Dahl" <f9aid at>
  • Date: Sat, 24 Nov 2001 16:43:51 -0500 (EST)
  • Sender: owner-wri-mathgroup at

square[x_] := 1 - 2*Floor[Mod[x, 2]]

Ingolf Dahl, Chalmers University

-----Original Message-----
From: Peter Dimitriou [mailto:peterangelo at]
To: mathgroup at
Subject: [mg31680] [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:

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?


  • Prev by Date: Re: inverse function computation
  • Next by Date: Re: square wave function
  • Previous by thread: Re: square wave function
  • Next by thread: Re: square wave function