Dirac Delta function

In mathematica it is easy to define a function, lets consider
the statement

fun[x_] = x^2

This statement defines a mathematica function called fun, with
a dummy argument x. It is important to put the underbar on x, it means that x_ is a dummy argument on the lhs.

\("Examples"; 
fun[x]\)

fun[z]

fun[thisisadummyvariable]

You get the idea.

We can now plot this function (look under help bar for all the plotting routines available).

Plot[fun[x], {x, -1, 1}]

Getting back to our lesson. Lets define the following function

f[x_, epsilon_] = 1/epsilon 1/Sqrt[Pi] Exp[-(x/epsilon)^2]

Plot[f[x, 0.1], {x, -3, 3}, PlotRange -> All]

Lets Integrate this function (numerically) for different values of epsilon.
for epsilon=0.2 we get

NIntegrate[f[x, 0.2], {x, -3, 3}]

How about this integral   \(TraditionalForm
      \`∫\_\(-∞\)\%∞\(\( g(x)\)\ 
            \(f(x, epsilon)\)\) dx\), for different functions g[x], if f is a dirac delta this
integral should approach the value g[x=0]

lets choose

g[x_] = 2.3 Cos[x]

NIntegrate[g[x] f[x, 1], {x, -3, 3}]

Table[
      NIntegrate[g[x] f[x, epsilon], {x, -3, 3}], {epsilon, 1, 0.1, 
        -0.1}]

(This is a table of integrals)

Note the integral appears to converge to the value g(0)

So we have shown that

(∫_(-∞)^∞) g (x) 
          ((E^(-((x^2)/(ϵ^2))))/(ϵ 
                (Sqrt[ π]))) \[DifferentialD]x = 
      g (0)   as ϵ -> 0,  
    or ((E^(-((x^2)/(ϵ^2))))/(ϵ 
            (Sqrt[ π]))) behaves like δ (x) when  
        ϵ -> 0

This representation is not unique, lets define

f2[x_, epsilon_] =  1/Pi Sin[x/epsilon]/x

Plot[f2[x, 0.1], {x, -10, 10}, PlotRange -> All]

Try plotting this for different values of epsilon, note this
function doesnt look anything like f, but we show it has the same
properties when epsilon->0. Lets perform our integral.

NIntegrate[g[x] f2[x, 0.01], {x, -Infinity, Infinity}, 
      Method -> Oscillatory]

Note: because of the rapid oscillations it is  difficult to numerically
integrate this function (it easy analytically).

The above representation is commonly used and is equivalent to

δ[x] = 
      (1/(2  π)) 
          (∫_(-∞)^∞) (e^(i p x)) 
              \[DifferentialD]p =  
        (Underscript[Lim, L -> ∞]) (1/(2  π)) 
            (∫_(-L)^L) (e^(i p x)) \[DifferentialD]p = 
           (Underscript[Lim, L -> ∞]) (( sin (L x))/(π x)) = 
             (Underscript[Lim, ϵ -> 0]) 
              (( sin ((x/ϵ)))/(π x))

\(
There\ are\ several\ representations\ of\ the\ dirac\ delta.
Show, 
    as\ above, \ that\ yet\ another\ representation\ is\ given\)\(by
\)δ[x] = 
      (1/π) (ϵ/((ϵ^2) + (x^2))) as ϵ -> 0.