DensityPlot - Maple Help

Statistics

 DensityPlot
 plot the density of a random variable

 Calling Sequence DensityPlot(X, options, plotoptions) DensityPlot['interactive'](X)

Parameters

 X - random variable or distribution options - (optional) equation(s) of the form option=value where option is one of discont or range; specify options for generating the density plot plotoptions - options to be passed to the plots[display] command

Description

 • The DensityPlot command plots the density of the specified random variable. By default, the range is taken between the 1st and the 99th percentiles of the underlying distribution.
 • The first parameter can be a distribution (see Statistics[Distribution]), a random variable, or an algebraic expression involving random variables (see Statistics[RandomVariable]).
 • It must be possible to evaluate the PDF (for continuous distributions) or the ProbabilityFunction (for discrete distributions) to numeric constants.
 • If the ['interactive'] option is used, then a dialog box appears that allows for customized creation of the plot.

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot/options for details.
 • discont=true or false
 Allows detection of discontinuities. The discont option can only be specified when X contains at least one continuous random variable. By default discont is set to false. For details, see plot/discont.
 • range=deduce or range
 By default this is deduce.  This option is used to bound the horizontal real range on which the density is plotted.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $X≔\mathrm{RandomVariable}\left(\mathrm{Normal}\left(0,1\right)\right)$
 ${X}{≔}{\mathrm{_R}}$ (1)
 > $Y≔\mathrm{RandomVariable}\left(\mathrm{Normal}\left(0,1\right)\right)$
 ${Y}{≔}{\mathrm{_R0}}$ (2)
 > $\mathrm{DensityPlot}\left(X,\mathrm{range}=-2..2\right)$
 > $\mathrm{DensityPlot}\left(\frac{X}{Y},\mathrm{range}=-2..2,\mathrm{color}="Niagara Red"\right)$
 > $f≔x↦\mathrm{piecewise}\left(-1
 ${f}{≔}{x}{↦}\left\{\begin{array}{cc}\frac{{3}{\cdot }{{x}}^{{2}}}{{2}}& {-1}{<}{x}{<}{1}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (3)
 > $F≔\mathrm{Distribution}\left(\mathrm{PDF}=f\right):$
 > $Z≔\mathrm{RandomVariable}\left(F\right):$
 > $\mathrm{DensityPlot}\left(Z,\mathrm{range}=-2..2,\mathrm{thickness}=2,\mathrm{color}=\mathrm{red},\mathrm{discont}=\mathrm{true}\right)$
 > $\mathrm{DensityPlot}\left(Z,\mathrm{range}=-2..2,\mathrm{thickness}=2,\mathrm{color}=\mathrm{red},\mathrm{discont}=\mathrm{false}\right)$

Plot options such as background color or gridlines are passed to the plots:-display command:

 > $\mathrm{DensityPlot}\left(\mathrm{GeometricDistribution}\left(\frac{1}{3}\right),\mathrm{background}="LightGrey",\mathrm{gridlines}\right)$
 > 

Compatibility

 • The Statistics[DensityPlot] command was updated in Maple 2017.
 • The discont option was introduced in Maple 2017.