I recently encountered a problem in which I needed to uniformly sample vectors with positive values in $$\mathbb{R}^n$$ that had unit $$L_1$$ norm, where the $$L_1$$ norm is $\lVert (x_1, x_2, \ldots, x_n)^T \rVert = |x_1| + |x_2| + \ldots + |x_n|$ The…

On manifolds with positive definite metrics (e.g. dot product), any localized embedding of an $$n-1$$ dimensional submanifold will have tangent spaces that partition those of the original manifold into an $$n-1$$ dimensional subspace (that of the submanifold) and a $$1$$ dimensional subspace (the part of the tangent space orthogonal…

This is a the result of the second project of CS194-26 from Fall 2020 1.1: Finite Difference Operators We compute the magnitude of the gradient by first finding the gradient in the x and y directions, dx and dy respectively, then computing (dx**2 + dy**2)**0.5 to…

I recently came across the definition for Markov's Inequality as it's used in measure-theory and was shocked at how intuitive it was. It turns out this definition is roughly equivalent to the one taught in most undergraduate probability theory courses and helped me a lot to understand it. Firstly, for…

A lot of students in office hours seemed to be unsure of what a Modspace is and exactly what $$\mod m$$ means (is it a function?) or how $$3 \equiv 18 \mod 15$$. To start out, we need to talk about what a Modspace is. (Note: super mathy things that…

Breadth-First search is one of the most widely applied graph algorithms. It's used in bioinformatics to determine the locality of areas of the brain, social network analysis, recommender systems, any many other applications. It is a simple algorithm used to determine the number of edges from one vertex to another,…