Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# dirac

The Dirac delta distribution

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

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

## Description

dirac(x) represents the Dirac delta distribution.

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

The calls dirac(x, 0) and dirac(x) are equivalent.

If the argument x represents a non-zero 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 predefined 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

is implemented for real numerical values a.

The integration function int treats dirac as the usual delta distribution. Cf. Example 3.

## Environment Interactions

dirac reacts to properties of identifiers.

## Examples

### 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)```

Arguments of domain type DOM_COMPLEX yield undefined:

`dirac(1 + I), dirac(2/3 + 7*I), dirac(0.1*I, 1), dirac(ln(-5))`

A symbolic call is returned for other arguments:

`dirac(0), dirac(x), dirac(x + I, 2), dirac(x, n)`

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

A natural value for dirac(0) is infinity:

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

`delete dirac(0): protect(dirac): dirac(0)`

### Example 2

dirac reacts to assumptions set by assume:

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

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

`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)`

```int(int(f(x, y)*dirac(x - y^2), x = -infinity..infinity),
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)`

For delta peaks on the boundary of the integration region, we use the convention that heaviside(0) equals :

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

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)```

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)`

## Parameters

 x n An arithmetical expression representing a nonnegative integer

## Return Values

Arithmetical expression.

x