Common directive options:
[docutils.git] / test / functional / input / data / math.txt
blob15acdcdd09366527c0b9eab9ce37b56c4c87df69
1 Mathematics
2 -----------
4 Docutils supports inline math with the prefix or postfix ``:math:``
5 role specificator, :math:`n! + \sin(x_n^2)` and `A_\text{c} =
6 \frac{\pi}{4} d^2`:math:, as well as displayed math via the
7 `math` directive:
9 .. math::
11    f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
13 Content may start on the first line of the directive, e.g.
15 .. math:: N = \frac{\text{number of apples}}{7}
17 Equations can be labeled with a reference name using the ``:name:`` option.
18 See `eq:M`_ and `eq:schrödinger`_ below.
20 The determinant of the matrix
22 .. math:: :name: eq:M
24    \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
26 is :math:`|\mathbf{M}| = ad - bc`.
28 More than one display math block can be put in one math directive.
29 For example, the following sum and integral with limits:
31 .. math::
33           \int_0^1 x^n dx = \frac{1}{n + 1}
35           \sum_{n=1}^m n = \frac{m(m+1)}{2}
37 LaTeX-supported Unicode math symbols can be used in math roles and
38 directives:
40 The Schrödinger equation
42 .. math:: :name: eq:schrödinger
44    i\hbar \frac{∂}{∂t}Ψ = \hat{H}Ψ,
45    
47 with the *wave function* :math:`Ψ`, describes how the quantum state of a
48 physical system changes in time.
50 Math-Accents:
51   .. list-table::
52      :class: borderless
54      * - :math:`\acute{a}`      ``\acute{a}``
55        - :math:`\dot{t}`        ``\dot{t}``
56        - :math:`\hat{\gamma}`   ``\hat{\gamma}``
58      * - :math:`\grave{a}`      ``\grave{a}``
59        - :math:`\ddot{t}`       ``\ddot{t}``
60        - :math:`\tilde{\alpha}` ``\tilde{\alpha}``
62      * - :math:`\breve{x}`      ``\breve{x}``
63        - :math:`\dddot{t}`      ``\dddot{t}``
64        - :math:`\vec{\imath}`   ``\vec{\imath}``
66      * - :math:`\check{a}`      ``\check{a}``
67        - :math:`\bar{a}`        ``\bar{a}``
68        - :math:`\vec{R}`        ``\vec{R}``
71        \widetilde{xxx}
72        \widehat{xxx}
74 Modulation Transfer Function:
76 .. math::
78  \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
79                          {\mathcal{F}\{ s(x)\} |_{ω_{x}=0}}\right|
80             = \mathrm{abs}\left(\frac
81                   {∫_{-∞}^{∞}s(x) \mathrm{e}^{\mathrm{i}ω_{x}x}\mathrm{d}{x}}
82                   {∫_{-∞}^{∞}s(x)\mathrm{d}{x}}
83               \right).
85 Math split over two lines: If a double backslash is detected outside a
86 ``\begin{...} \end{...}`` pair, the math code is wrapped in an AMSmath_
87 ``align`` environment:
89 .. math::
91    s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_δ(x-x') \\
92                        & = ∫ s_{\mathrm{in}}(x')s_δ(x-x')\mathrm{d}x'
94 Cases ("manually", with ``matrix`` environment):
96 .. math::
98    \mathrm{sgn}(x) = \left\{\begin{matrix}
99                        -1 & x<0\\
100                        1 & x>0
101                      \end{matrix}\right.
103 Cases with the AMSmath_ ``cases`` environment (not (yet) supported by
104 HTML writers with ``--math-output=MathML``):
106 .. math::
108    \mathrm{sgn}(x) = \begin{cases}
109                        -1 & x<0\\
110                         1 & x>0
111                      \end{cases}
113 .. _AMSmath: ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf