xref: /petsc/doc/manual/dt.md (revision b11d9968bc79904c690b122f9399be46447eb113)
1*7f296bb3SBarry Smith(ch_dt)=
2*7f296bb3SBarry Smith
3*7f296bb3SBarry Smith# PetscDT: Discretization Technology in PETSc
4*7f296bb3SBarry Smith
5*7f296bb3SBarry SmithThis chapter discusses the low-level infrastructure which supports higher-level discretizations in PETSc, which includes things such as quadrature and probability distributions.
6*7f296bb3SBarry Smith
7*7f296bb3SBarry Smith## Quadrature
8*7f296bb3SBarry Smith
9*7f296bb3SBarry Smith## Probability Distributions
10*7f296bb3SBarry Smith
11*7f296bb3SBarry SmithA probability distribution function (PDF) returns the probability density at a given location $P(x)$, so that the probability for an event at location in $[x, x+dx]$ is $P(x) dx$. This means that we must have the normalization condition,
12*7f296bb3SBarry Smith
13*7f296bb3SBarry Smith$$
14*7f296bb3SBarry Smith\int_\Omega P(x) dx = 1.
15*7f296bb3SBarry Smith$$
16*7f296bb3SBarry Smith
17*7f296bb3SBarry Smithwhere :math:Omega is the domain for $x$. This requires that the PDF must have units which are the inverse of the volume form $dx$, meaning that it is homogeneous of order $d$ under scaling
18*7f296bb3SBarry Smith
19*7f296bb3SBarry Smith$$
20*7f296bb3SBarry Smithpdf(x) = \lambda^d P(\lambda x).
21*7f296bb3SBarry Smith$$
22*7f296bb3SBarry Smith
23*7f296bb3SBarry SmithWe can check this using the normalization condition,
24*7f296bb3SBarry Smith
25*7f296bb3SBarry Smith$$
26*7f296bb3SBarry Smith\begin{aligned}
27*7f296bb3SBarry Smith  \int_\Omega P(x) dx &= \int_\Omega P(\lambda s) \lambda^d ds \\
28*7f296bb3SBarry Smith                      &= \int_\Omega P(s) \lambda^{-d} \lambda^d ds \\
29*7f296bb3SBarry Smith                      &= \int_\Omega P(s) ds \\
30*7f296bb3SBarry Smith                      &= 1
31*7f296bb3SBarry Smith\end{aligned}
32*7f296bb3SBarry Smith$$
33*7f296bb3SBarry Smith
34*7f296bb3SBarry SmithThe cumulative distribution function (CDF) is the incomplete integral of the PDF,
35*7f296bb3SBarry Smith
36*7f296bb3SBarry Smith$$
37*7f296bb3SBarry SmithC(x) = \int^x_{x_-} P(s) ds
38*7f296bb3SBarry Smith$$
39*7f296bb3SBarry Smith
40*7f296bb3SBarry Smithwhere $x_-$ is the lower limit of our domain. We can work out the effect of scaling on the CDF using this definition,
41*7f296bb3SBarry Smith
42*7f296bb3SBarry Smith$$
43*7f296bb3SBarry Smith\begin{aligned}
44*7f296bb3SBarry Smith  C(\lambda x) &= \int^{\lambda x}_{x_-} P(s) ds \\
45*7f296bb3SBarry Smith               &= \int^{x}_{x_-} \lambda^d P(\lambda t) dt \\
46*7f296bb3SBarry Smith               &= \int^{x}_{x_-} P(t) dt \\
47*7f296bb3SBarry Smith               &= C(x)
48*7f296bb3SBarry Smith\end{aligned}
49*7f296bb3SBarry Smith$$
50*7f296bb3SBarry Smith
51*7f296bb3SBarry Smithso the CDF itself is scale invariant and unitless.
52*7f296bb3SBarry Smith
53*7f296bb3SBarry SmithWe do not add a scale argument to the PDF in PETSc, since all variables are assuming to be dimensionless. This means that inputs to the PDF and CDF should be scaled by the appropriate factor for the units of $x$, and the output can be rescaled if it is used outside the library.
54