Re: Piecewise and Integral
- To: mathgroup at smc.vnet.net
- Subject: [mg75239] Re: Piecewise and Integral
- From: dh <dh at metrohm.ch>
- Date: Sat, 21 Apr 2007 23:13:52 -0400 (EDT)
- References: <f09g01$pe$1@smc.vnet.net>
$Version: 5.1 for Microsoft Windows (October 25, 2004) Hi, I am getting 10 as expected. Are you fooling yourself? Daniel zosi wrote: > Hi, > > 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 > Italy > > ----------------- 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 > \[LessEqual]\[Tau]}, > {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 -------------------- >