Skip to main content

Zhy

Mathematica: Faster Multinormal Sampling with Different Covariance Matrices

Let's say we are given a set of different covariance matrices. We wish to draw a single sample of the multivariate normal distribution from each of these covariance matrices.

Assuming the mean vector is zero, we would code this for a single draw from a single covariance matrix sigma in Mathematica:

MultinormalDraw[sigma_] :=
    RandomVariate[MultinormalDistribution[sigma]]

To demonstrate why this is slow, we will use a hundred randomly generated $200\times 200$ covariance matrices (that is, matrices that are both symmetric and positive definite):

Read more…

Multivariable Epsilon-Delta proof example

Multivariable epsilon-delta proofs are generally harder than their single variable counterpart. The difficulty comes from the fact that we need to manipulate $|f(x,y) - L|$ into something of the form $\sqrt{(x-a)^2 + (y-b)^2}$, which is much harder to do than the simple $|x-a|$ with single variable proofs. This often requires several ingenious algebraic tricks that, at first don't seem to make much sense. Consider the following example.

Let \(f : \{(x,y)\in {\mathbb{R}}^2 : x^2 \ne y^2\} \to \mathbb{R}\) be defined by

\begin{equation*} f(x,y) = \frac{x^3 - y^3}{x^2-y^2}. \end{equation*}

Prove that the limit

\begin{equation*} \lim_{(x,y)\to (a,a)} f(x,y) \end{equation*}

exists for all real $a \ne 0$.

Read more…