Re: LaplaceTransform[SquareWave[]] ??
- To: mathgroup at smc.vnet.net
- Subject: [mg107324] Re: LaplaceTransform[SquareWave[]] ??
- From: Geico Caveman <spammers-go-here at spam.invalid>
- Date: Tue, 9 Feb 2010 02:45:30 -0500 (EST)
- References: <hkoich$t3c$1@smc.vnet.net> <hkp1n0$7fb$1@smc.vnet.net>
On 2010-02-08 05:57:04 -0700, "Nasser M. Abbasi" <nma at 12000.org> said: > On Feb 8, 12:35 am, Geico Caveman <spammers-go-h... at spam.invalid> > wrote: >> In[1]:=LaplaceTransform[SquareWave[t], t, s] >> Out[1]:=LaplaceTransform[SquareWave[t], t, s] >> >> That is a pretty standard Laplace transform. What gives ? >> >> LaplaceTransform[l'[t]] is fine. >> >> I am using Mathematica 7 on Mac OSX Snow Leopard. > > > My guess is that you should not use SquareWave as is for this sort of > thing. There seems to be some limit: > > Integrate[SquareWave[t],{t,0,1}] > Integrate[SquareWave[t],{t,0,2}] > .... > Integrate[SquareWave[t],{t,0,99}] > > All of the above gives 0 as expected. But > > Integrate[SquareWave[t],{t,0,100}] > > failes with the error > > "Integrate::mpwc: {At Line = 22, the input > was:,Integrate[SquareWave[t],{t,0,100}],Integrate} was unable to > convert {At Line = 22, the input was:,Integrate[SquareWave[t],{t, > 0,100}],Floor[t]} to Piecewise, because the required number {At Line > 22, the input was:,Integrate[SquareWave[t],{t,0,100}],101} of > piecewise cases sought exceeds the internal limit $MaxPiecewiseCases > {At Line = 22, the input was:,Integrate[SquareWave[t],{t,0,100}],100}. >>> " > > So, there is an internal limit $MaxPiecewiseCases > > In[24]:= $MaxPiecewiseCases > Out[24]= 100 > > So, my guess is that the Laplace integral > > Integrate[SquareWave[t]*Exp[-s t],{t,0,Infinity}] > > Was failing internally on this limit. Because when I do > > Integrate[SquareWave[t]*Exp[-s t],{t,0,99}] > It works, but > Integrate[SquareWave[t]*Exp[-s t],{t,0,100}] > it fails > and infinity is more than 100, so LaplaceTransform[] must have hit > this internally somewhere, but did not report it? > > But the square wave is a simply function, it flips between 1 and -1 > with period 1, so we can directly do the Laplace integral on it. > > Split the integral into 2 parts. One part does the part when the wave > is +1, and the second integral does the part when the wave is -1. Then > add the 2 integrals together, and take the limit to infinity, I get > > Tanh[s/4]/s > > Here is the code: > > Clear[int1,int2,t,k,M,s] > int1=Integrate[Exp[-s t],{t,k,k+1/2}]; > int2=Integrate[Exp[-s t],{t,k+1/2,k+1}]; > Sum[ int1-int2,{k,0,M}]//FullSimplify; > Assuming[Element[s,Reals]&&s>0,Limit[%,M->Infinity]] > > Out[112]= Tanh[s/4]/s > > Is this is correct Laplace transform for square wave? > > --Nasser Thanks for the detailed response. I was planning on using the SquareWave as the forcing function for a Riccati equation and then transform to s-domain to see if I could simplify something (like drop a term or so) to get an approximate solution. I know what the transform for the -1,1 and 0,1 square wave is :)