# Dirac-class

##### Class "Dirac"

The Dirac distribution with location \(l\), by default \(=0\), has density \(d(x) = 1\) for \(x = l\), \(0\) else.

- Keywords
- distribution

##### Objects from the Class

Objects can be created by calls of the form `Dirac(location)`

.
This object is a `Dirac`

distribution.

##### Slots

`img`

Object of class

`"Naturals"`

: The space of the image of this distribution has got dimension 1 and the name "Real Space".`param`

Object of class

`"DiracParameter"`

: the parameter of this distribution (location), declared at its instantiation`r`

Object of class

`"function"`

: generates random numbers`d`

Object of class

`"function"`

: density function`p`

Object of class

`"function"`

: cumulative function`q`

Object of class

`"function"`

: inverse of the cumulative function`support`

Object of class

`"numeric"`

: a (sorted) vector containing the support of the discrete density function`.withArith`

logical: used internally to issue warnings as to interpretation of arithmetics

`.withSim`

logical: used internally to issue warnings as to accuracy

`.logExact`

logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function

`.lowerExact`

logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function

`Symmetry`

object of class

`"DistributionSymmetry"`

; used internally to avoid unnecessary calculations.

##### Extends

Class `"DiscreteDistribution"`

, directly.
Class `"UnivariateDistribution"`

, by class `"DiscreteDistribution"`

.
Class `"Distribution"`

, by class `"DiscreteDistribution"`

.

##### Methods

- -
`signature(e1 = "Dirac", e2 = "Dirac")`

- +
`signature(e1 = "Dirac", e2 = "Dirac")`

- *
`signature(e1 = "Dirac", e2 = "Dirac")`

- /
`signature(e1 = "Dirac", e2 = "Dirac")`

: For the Dirac distribution these operations are trivial.- initialize
`signature(.Object = "Dirac")`

: initialize method- location
`signature(object = "Dirac")`

: returns the slot`location`

of the parameter of the distribution- location<-
`signature(object = "Dirac")`

: modifies the slot`location`

of the parameter of the distribution- log
`signature(object = "Dirac")`

: returns an object of class`"Dirac"`

distribution with log-transformed`location`

parameter.- Math
`signature(object = "Dirac")`

: given a`"Math"`

group generic`fun`

an object of class`"Dirac"`

distribution with`fun`

-transformed`location`

parameter is returned.

further arithmetic methods see operators-methods

##### See Also

`DiracParameter-class`

`DiscreteDistribution-class`

`Naturals-class`

##### Examples

```
# NOT RUN {
D <- Dirac(location = 0) # D is a Dirac distribution with location=0.
r(D)(1)
# r(D)(1) generates a pseudo-random-number according to a Dirac
# distribution with location = 0,
# which of course will take 0 as value almost surely.
d(D)(0) # Density of this distribution is 1 for x = 0.
p(D)(1) # Probability that x < 1 is 1.
q(D)(.1) # q(D)(x) is always 0 (= location).
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
location(D) # location of this distribution is 0.
location(D) <- 2 # location of this distribution is now 2.
# }
```

*Documentation reproduced from package distr, version 2.7.0, License: LGPL-3*