Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Dirac Delta Function: Basics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75185] Re: Dirac Delta Function: Basics
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Fri, 20 Apr 2007 00:31:19 -0400 (EDT)
  • References: <f07a53$4ci$1@smc.vnet.net>

Some important things to know:

Currently, there are two distributions built into Mathematica:
DiracDelta and UnitStep.

In[28]:=
(Information[#1, LongForm -> False] & ) /@ {UnitStep, DiracDelta};

"UnitStep[x] represents the unit step function, equal to 0 for x < 0
and 1 for x =E2=89=A5 0. UnitStep[x1, x2, ... ] represents the
multidimensional unit step function which is 1 only if none of the xi
are negative."

"DiracDelta[x] represents the Dirac delta function =CE=B4(x).
DiracDelta[x1, x2, ... ] represents the multidimensional Dirac delta
unction =CE=B4(x1, x2, =E2=80=A6)."

Both of them, like all generalized functions, are defined for real
arguments only.

In[33]:=
({DiracDelta[#1], UnitStep[#1]} & ) /@ {1, -5/3, 6 + I}

Out[33]=
{{0, 1}, {0, 0}, {DiracDelta[6 + I], UnitStep[6 + I]}}

(*DiracDelta[0] stays uneveluated; it's no infinity*)

Here is a plot of UnitStep[x]

In[39]:=
Show[Block[{$DisplayFunction = Identity}, (Plot[UnitStep[x], {x,
#1[[1]], #1[[2]]}, Axes -> False, Frame -> True] & ) /@
Partition[Range[-2, 2], 2, 1]]]

(*in this way we ommit the buggy vertical line appeared at x=0*)

Obviously the following plot of  the DiracDelta (generalized) function
looks quite logical.

In[43]:=
Plot[DiracDelta[x], {x, -2, 2}, Axes -> False, Frame -> True]

That is, the nonnumerical value at x=0 was not detected.

In[44]:=
Cases[%, {(x_)?NumericQ, (y_)?NumericQ} /; -0.002 < x < 0.002,
Infinity]

Out[44]=
{{-0.0019572,0.},{-0.00125518,0.},{-0.000607188,0.},{0.000619756,0.},
{0.00192017,0.}}

There are some identities of these distributions that Mathematica
knows about. But they required the
use of FunctionExpand. So, for example

In[56]:=
FunctionExpand /@ {UnitStep[(x - 1)*(x + 3)*(x - 5)], UnitStep[x]^2,
DiracDelta[x*(x - 1)], UnitStep[-x^4 - 1],
   UnitStep[x^4 + 1]}

Out[56]=
{UnitStep[-5 + x] - UnitStep[-1 + x] + UnitStep[3 + x], UnitStep[x],
DiracDelta[-1 + x] + DiracDelta[x], 0, 1}

The generalization to more than one variable is also possible.

The Dirac delta function and the Heaviside function are connected and
Mathematica
knows this relation

In[57]:=
Derivative[1][UnitStep][x]
Derivative[-1][DiracDelta][x]

Out[57]=
DiracDelta[x]
Out[58]=
UnitStep[x]

Integrate and D knows to deal with functions.

In[67]:=
Integrate[Cos[x]/(1 + x^2)^(1/2), {x, 0, Infinity}]
Integrate[(Cos[x]*UnitStep[x])/(1 + x^2)^(1/2), {x, -Infinity,
Infinity}]

Out[67]=
BesselK[0, 1]
Out[68]=
BesselK[0, 1]

In[68]:=
Integrate[UnitStep[Log[x] + 2], {x, 0, 2*Pi}]

Out[68]=
-(1/E^2) + 2*Pi

In[70]:=
Integrate[Log[x]*DiracDelta[x - 3], {x, -2, 5}]

Out[70]=
Log[3]

(*At this point I want to inform you about the presence of the
Integration of Piecewise Functions with Applications
notebook of Maxim Rytin available from here:

http://library.wolfram.com/infocenter/MathSource/5117/

which knows to deal even better that Integrate in relevant cases with
distributions.*)

In[76]:=
(D[UnitStep[x], {x, #1}] & ) /@ Range[4]

Out[76]=
{DiracDelta[x], Derivative[1][DiracDelta][x], Derivative[2][DiracDelta]
[x], Derivative[3][DiracDelta][x]}

Currently only linear functionals are allowed. So the next integral
stays unevaluated.

In[81]:=
Integrate[DiracDelta[x]^2, {x, -Infinity, Infinity}]

Out[81]=
Integrate[DiracDelta[x]^2, {x, -Infinity, Infinity}]

A UnitStep distribution can appear inside NIntegrate.

In[83]:=
Integrate[UnitStep[x^12 - 6], {x, -3, 3}]
{NIntegrate[UnitStep[x^12 - 6], {x, -3, 3}], N[%]}

Out[83]=
6 - 2*6^(1/12)
Out[84]=
{3.6779266552520116, 3.6779266552520116}

For DiracDelta this is not the case.

In[86]:=
NIntegrate[1 + DiracDelta[Exp[x] - 1/2], {x, -1, 1}] (*incorrect*)
Out[86]=
2=2E

In[89]:=
Integrate[1 + DiracDelta[Exp[x] - 1/2], {x, -1, 1}]
Out[89]=
4

Distributions like the Dirac distribution or the Heaviside
distribution are often viewed as limits from continuous functions.

But neither Limit nor Sum recognise it.

In[90]:=
Limit[e/(x^2 + e^2), e -> 0]

Out[90]=
0

In[91]:=
Sum[Exp[I*k*x], {k, -Infinity, Infinity}]

Out[91]=
0

(*in a distributional sense we get 2Pi DiracDelta[x]

Indeed

In[94]:=
Sqrt[2*Pi]*FourierTransform[1, x, s]

Out[94]=
2*Pi*DiracDelta[s]

*)

Here is one example of such a sequence along with a visualization

In[101]:=
Needs["Graphics`"]
delta[n_][x_] := n/(Sqrt[Pi]/E^((-n^2)*x^2))
frame[n_] := Plot[delta[n][x], {x, -2, 2}, PlotRange -> {-0.1, 6.1},
Frame -> True,
    PlotLabel -> delta["n"][x]", n ="NumberForm[n, {4, 2},
NumberPadding -> {" ", "0"}], ImageSize -> {800, 500}];
Animate[frame[n], {n, 1, 10, 0.25}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -
> 0.1, AnimationDirection -> ForwardBackward]}]

And here is one example of application of the sequence

In[105]:=
Integrate[delta[n][x^4 - 1], {x, -Infinity, Infinity}, Assumptions ->
n > 0]
Limit[%, n -> Infinity]
FunctionExpand[%]

Out[105]=
(n^(3/4)*(4*Gamma[9/8]*Hypergeometric1F1[1/8, 1/2, n^2] +
n*Gamma[5/8]*Hypergeometric1F1[5/8, 3/2, n^2]))/(E^n^2*(2*Sqrt[Pi]))
Out[106]=
(Gamma[1/8] + 8*Gamma[9/8])/(4*Gamma[1/8])
Out[107]=
1/2

Indeed

In[108]:=
Integrate[DiracDelta[x^4 - 1], {x, -Infinity, Infinity}, Assumptions -
> n > 0]

Out[108]=
1/2

Be also aware that currently only the integral transforms will return
distributions in their output for inputs that do not contain
distributions. Functions like D and Integrate know how to deal with
certain distributions, but their output will only contain them when
their input does.

So for example

In[110]:=
(Integrate[Cos[x]*Exp[(-I)*x*s], {x, -Infinity, Infinity},
GenerateConditions -> #1] & ) /@ {True, False}
Integrate::idiv: Integral ofCos[x]/E^(I*s*x) does not converge on {-
Infinity, \
Infinity}.
Out[110]=
{Integrate[Cos[x]/E^(I*s*x), {x, -Infinity, Infinity},
GenerateConditions -> True],
  Integrate[Cos[x]/E^(I*s*x), {x, -Infinity, Infinity},
GenerateConditions -> False]}

whereas

In[112]:=
FourierTransform[Cos[x], x, s]

Out[112]=
Sqrt[Pi/2]*DiracDelta[-1 + s] + Sqrt[Pi/2]*DiracDelta[1 + s]

I hope that these are enough for now!

Regards
Dimitris

PS

References
1) M. Trott's "Guidebook for Symbolics"
2) R. N. Bracewell's "The Fourier Transform and its applications"
3) Estrada and Kanwal's "Ditributional Approach to Asymptotics"


=CE=9F/=CE=97 Gopinath Venkatesan =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> Hello Friends
>
> I browsed some of the previous posts in this forum on Dirac Delta functio=
n, and found some interesting distributions used to represent the delta fun=
ction, at the below website:
>
> <http://mathworld.wolfram.com/DeltaFunction.html>
>
> Also when I tried using one of the distribution, Fourier series approxima=
tion (shown below), I was getting very different solutions for different en=
tries of upper limit of k, even at higher values of upper limits.
>
> DeltaF(x - a) = 1/(2*Pi) +
>    (1/Pi)*Sum[Cos[k*a]*Cos[k*x] + Sin[k*a]*Sin[k*x],
>      {k, 1, Infinity}]
>
> (here DeltaF is DiracDelta).
>
> Does anyone here can give me suggestions on using right distributions and=
 parameters. Thanks.
>
> Also Can I use the DiracDelta[] function available in Mathematica itself.=
 How does Mathematica calculate them.
>
> I am not integrating the equation containing DiracDelta[], so as seen fro=
m the Mathematica examples, I think it is doing Laplace transformations.
>
> Any help/directions to resources are appreciated. Thanks,
>
> Gopinath
> Graduate Student
> University of Oklahoma



  • Prev by Date: Re: Assign delayed but fixed value
  • Next by Date: Piecewise and Integral
  • Previous by thread: Re: Dirac Delta Function: Basics
  • Next by thread: Re: Dirac Delta Function: Basics