Test of math, code, admons, quiz

Math

We have $$ \begin{equation} F = \int_a^b f(x)dx. \end{equation} $$

Code

We can do the integral by

>>> from sympy import *
>>> x = 'symbols('x')
>>> f = x*sin(x)*exp(-x)
>>> integrate(f, x(0, 4))
-2*exp(-4)*sin(4) - 5*exp(-4)*cos(4)/2 + 1/2

Or we can do it numerically via the Trapezoidal rule:

import numpy

def trapezoidal(f, a, b, n=100):
    """Integrate f from a to b with 100 intervals."""
    x = numpy.linspace(a, b, n+1)
    F = (b-a)/float(n)*(numpy.sum(f(x)) - 0.5*(f(a) + f(b)))
    return F

def f(x):
    return x*numpy.sin(x)*numpy.exp(-x)

print trapezoidal(f, 0, 4)

Admonitions

Question. How do adminitions look like? That depends on the output format and what type of admon design in the format one has chosen.

White space is important! Many DocOnce errors arise from wrong use of white space. The white space is not as critical as in reStructuredText, but is not ignored either, as in LaTeX and HTML.