MathGroup Archive 2007

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

Search the Archive

Piecewise and Integral

  • To: mathgroup at
  • Subject: [mg75189] Piecewise and Integral
  • From: zosi <zosi at>
  • Date: Fri, 20 Apr 2007 00:33:22 -0400 (EDT)


I have a problem that I considered (and still consider) trivial.

Let us suppose I have defined a Gate
(Period T and width \[Tau]= T/4), through Piecewise
and extended it periodically (see from In[1] to In[6]).
The Plot seems indicate that the extension is correct.
Now let us calculate the coefficient a0 according to
the usual formula In[13], having assumed that  \[Lambda]=0  (In[12])
The result Out[13] = 10  is correct.
If I consider another case, i.e., I change the value of \[Lambda]=1/10,
the result, 10,  is again correct  (as expected !).
But, if I try \[Lambda]= T/2 the result is 5 (instead of 10). Why ?
My interpretation is that the range
\[Tau]< x \[LessEqual]  T/2 is not evaluated.
Infact, when I remove  the ":"  in  In[3], the function is not defined
in the last interval ( but correctly Plotted !).

Any hint  to obtain  10 when \[Lambda]= T/2 ?
Thanks for your help

G. Zosi
Dipartimento Fisica Generale
Universita di Torino

 ----------------- begin -----------------------

In[1]:= Clear["Global`*"] ; Remove["Global`*"];$Line=0;

In[1]:= T=2;

In[2]:= \[Tau]= T/4.

In[3]:=   f[x_] := Piecewise[ {{0,  -T/2 \[LessEqual] x <- \[Tau]},
                              {10, -\[Tau] \[LessEqual]   x 
                               {0,     \[Tau]< x \[LessEqual]  T/2}}]
In[4]:= f[x_]:=f[x-T]/;x >T/2  

In[5]:= f[x_]:=f[x+T]/;x<-T/2

In[6]:= Plot[f[x],{x,-2 T,2 T}];

In[12]:= \[Lambda]=0

In[13]:= a0 = (2/T)*Integrate[f[x],{x,-T/2. +\[Lambda] ,T/2.+\[Lambda]}]

Out[13] = 10

   Now try with  \[Lambda] = 1/10   and \[Lambda] = T/2
   --------------------- end --------------------

  • Prev by Date: Re: Dirac Delta Function: Basics
  • Next by Date: Re: neat way to program minimum of sum
  • Previous by thread: Re: Importing and retaining graphics
  • Next by thread: Re: Piecewise and Integral