       Re: LaplaceTransform[SquareWave[]] ??

• To: mathgroup at smc.vnet.net
• Subject: [mg107304] Re: LaplaceTransform[SquareWave[]] ??
• From: "Nasser M. Abbasi" <nma at 12000.org>
• Date: Mon, 8 Feb 2010 07:54:40 -0500 (EST)
• References: <hkoich\$t3c\$1@smc.vnet.net>

```On Feb 8, 12:35 am, Geico Caveman <spammers-go-h... at spam.invalid>
wrote:
> In:=LaplaceTransform[SquareWave[t], t, s]
> Out:=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:= \$MaxPiecewiseCases
Out= 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= Tanh[s/4]/s

Is this is correct Laplace transform for square wave?

--Nasser

```

• Prev by Date: Re: NDSolve with Dirichlet boundary condition
• Next by Date: Re: Derivative of Interpolation function is
• Previous by thread: LaplaceTransform[SquareWave[]] ??
• Next by thread: Re: LaplaceTransform[SquareWave[]] ??