MathGroup Archive 2007

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

Search the Archive

Re: Piecewise and Integral

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75277] Re: Piecewise and Integral
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 23 Apr 2007 05:42:14 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f09g01$pe$1@smc.vnet.net> <f0ekjv$prh$1@smc.vnet.net>

dh wrote:
> $Version: 5.1 for Microsoft Windows (October 25, 2004)
> 
> Hi,
> 
> I am getting 10 as expected. Are you fooling yourself?
> 
> Daniel

Hi Daniel,

Interesting. The issue might be version dependent since I have gotten 
the same result as Zosi, that is 5 rather 10 when lambda is equal to T/2 
(See Out[13]), with Mathematica 5.2.

In[1]:=
$Version

Out[1]=
5.2 for Microsoft Windows (June 20, 2005)

In[2]:=
T = 2;
Ï? = T/4.
f[x_] := Piecewise[{{0, Inequality[-T/2, LessEqual, x,
       Less, -Ï?]}, {10, -Ï? <= x <= Ï?},
     {0, Inequality[Ï?, Less, x, LessEqual, T/2]}}]
f[x_] := f[x - T] /; x > T/2
f[x_] := f[x + T] /; x < -T/2
Plot[f[x], {x, -2*T, 2*T}];
λ = 0
a0 = (2/T)*Integrate[f[x], {x, -T/2. + λ,
      T/2. + λ}]
λ = 1/10
a0 = (2/T)*Integrate[f[x], {x, -T/2. + λ,
      T/2. + λ}]
λ = T/2
a0 = (2/T)*Integrate[f[x], {x, -T/2. + λ,
      T/2. + λ}]

Out[3]=
0.5

Out[8]=
0

Out[9]=
10.

Out[10]=
1
--
10

Out[11]=
10.

Out[12]=
1

Out[13]=
5.



> 
> 
> 
> 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 --------------------
> 
> 
> 
> 



  • Prev by Date: Re: strange behavior of Integrate
  • Next by Date: Re: Outputting to file with fixed decimal digits
  • Previous by thread: Re: Piecewise and Integral
  • Next by thread: Updated BiokmodWeb, the web version of BIOKMOD