## `dirac` -- the Dirac delta distribution

#### Introduction

`dirac``(x)` represents the Dirac delta distribution.

`dirac``(x, n)` represents the n-th derivative of the delta distribution.

#### Call(s)

`dirac(x)`
`dirac(x, n)`

#### Parameters

`x` | - | an arithmetical expression
`n` | - | an arithmetical expression representing a nonnegative integer

#### Returns

an arithmetical expression.

### Overloadable:

`x`

#### Side Effects

`dirac` reacts to properties of identifiers.

#### Related Functions

`heaviside`

#### Details

- The calls `dirac(x, 0)` and `dirac(x)` are equivalent.
- If the argument `x` represents a non-zero real number, then 0 is returned. If `x` is a non-real number of domain type `DOM_COMPLEX`, then `undefined` is returned. For all other arguments, a symbolic function call is returned.
- `dirac` does not have a pre-defined value at the origin. Use

  `unprotect(dirac): dirac(0) := myValue:`

  and

  `dirac(float(0)) := myFloatValue: protect(dirac):`

  to assign a value (e.g., `infinity`).

- For univariate linear expressions, the simplification rule

      dirac(a*x - b, n) = sign(a)/a^(n+1)*dirac(x - b/a, n)

  is implemented for real numerical values `a`.
- The integration function `int` treats `dirac` as the usual delta distribution. Cf. example 3.

#### Example 1

`dirac` returns 0 for arguments representing non-zero real numbers:

    >> dirac(-3), dirac(3/2), dirac(2.1, 1),
       dirac(3*PI), dirac(sqrt(3), 3)

                                   0, 0, 0, 0, 0

Arguments of domain type `DOM_COMPLEX` yield `undefined`:

    >> dirac(1 + I), dirac(2/3 + 7*I), dirac(0.1*I, 1)

                          undefined, undefined, undefined

A symbolic call is returned for other arguments:

    >> dirac(0), dirac(x), dirac(ln(-5)), dirac(x + I, 2), dirac(x, n)

          dirac(0), dirac(x), dirac(I PI + ln(5)), dirac(x + I, 2),

             dirac(x, n)

    >> dirac(2*x - 1, n)

                                 dirac(x - 1/2, n)
                                 -----------------
                                       n + 1
                                      2

A natural value for `dirac(0)` is `infinity`:

    >> unprotect(dirac): dirac(0) := infinity: dirac(0)

                                     infinity

    >> delete dirac(0): protect(dirac): dirac(0)

                                     dirac(0)

#### Example 2

`dirac` reacts to assumptions set by `assume`:

    >> assume(x < 0): dirac(x)

                                         0

    >> assume(x, Type::Real): assume(x <> 0, _and): dirac(x)

                                         0

    >> unassume(x):

#### Example 3

The symbolic integration function `int` treats `dirac` as the delta distribution:

    >> int(f(x)*dirac(x - y^2), x = -infinity..infinity)

                                          2
                                       f(y )

    >> int(int(f(x, y)*dirac(x - y^2), x = -infinity..infinity),
           y = -1..1)

                                    2
                             int(f(y , y), y = -1..1)

The indefinite integral of `dirac` involves the step function `heaviside`:

    >> int(f(x)*dirac(x), x), int(f(x)*dirac(x, 1), x)

              heaviside(x) f(0), dirac(x) f(0) - heaviside(x) D(f)(0)

If the delta peak is on the boundary of the integration region, then the result involves a symbolic call of `heaviside``(0)`:

    >> int(f(x)*dirac(x - 3), x = -1..3)

                                 f(3) heaviside(0)

Note that `int` can handle the distribution only if the argument of `dirac` is linear in the integration variable:

    >> int(f(x)*dirac(2*x - 3), x = -10..10),
       int(f(x)*dirac(x^2), x = -10..10)

                     f(3/2)                  2
                     ------, int(f(x) dirac(x ), x = -10..10)
                       2

Also note that `dirac` should not be used for numerical integration, since the numerical algorithm will typically fail to detect the delta peak:

    >> numeric::int(dirac(x - 3), x = -10..10)

                                        0.0

#### Changes

- Derivatives of the distribution can now be represented by the second argument. Properties of identifiers set via `assume` are now taken into account. The handling of `dirac` by `int` was improved.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000