def mexican(lb, ub, n):
if n <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>x = numpy.linspace(lb, ub, n)<EOL>psi = (<NUM_LIT:1.>-x**<NUM_LIT>) * (<NUM_LIT>/(numpy.sqrt(<NUM_LIT>)*pi**<NUM_LIT>)) * numpy.exp(-x**<NUM_LIT:2>/<NUM_LIT>)<EOL>return psi<EOL>
r"""Generate the mexican hat wavelet

    The Mexican wavelet is:

    .. math:: w[x] = \cos{5x}  \exp^{-x^2/2}

    :param lb: lower bound
    :param ub: upper bound
    :param int n: waveform data samples
    :return: the waveform

    .. plot::
        :include-source:
        :width: 80%

        from spectrum import mexican
        from pylab import plot
        plot(mexican(0, 10, 100))