Solving Overdetermined Linear Systems

An overdetermined linear system is a linear system of $n$ equations in $m$ unknowns, where $n > m$.

\[\begin{align*} a_{11}x_{1} + a_{12}x_{2} + \cdots + a_{1m}x_{m} &= y_1 \\ a_{21}x_{2} + a_{22}x_{2} + \cdots + a_{2m}x_{m} &= y_2 \\ \vdots \hspace{2.5cm} &= \vdots \\ a_{n1}x_{2} + a_{n2}x_{2} + \cdots + a_{nm}x_{m} &= y_n \\ \end{align*}\] ... read more

Divisibility Rule of 9

While chatting with my son about how to determine all the factors of an integer he (or maybe my wife) said 9 must be a factor because the digits of the integer sum to 9. Which really surprised me. I don’t recall learning this fact in school. Which I can only blame on my poor American education…

Anyway, define $a_1a_0 := a_1 \times 10 + a_0$ where $a_i \in {0,1, \cdots, 9 }$. Suppose $a_0 + a_1 = 9$, then

  1. $a_1a_0 \ | \ 9$
  2. $a_1a_0 = (a_1 + 1) \times 9$.
... read more

Asteroids

Example game play was captured using a gif maker from GIPHY.

I made a game!

Maybe re-made is a better description. I coded my own multithreaded version of Asteroids, the classic arcade game. Following the link takes you to the GitHub repo of the game.

... read more

Perspective Projection

Derivations of the perspective projection matrix, whether in books or on the web, always feel either overly complicated or completely lacking in detail–sometimes the perspective projection matrix is just stated without much explaination. In surveys of image projection, that is projection of a 3D scene to 2D, orthographic projection is presented as a contrasting method without relation to perspective projection. ... read more

Projecting a 3D Scene to the Image Plane

Given a 3D scene in world coordinates, how does an image of the scene form in the camera, and how do 3D scene points project to the image plane? The short answer to the later question is the camera matrix. And this short note is devoted to deriving the camera matrix. First some mathematical preliminaries. ... read more

Rotating Homogeneous Polynomials & Representations of $SO(3)$

Under the guise of rotating solid spherical harmonic functions, I want to investigate the computational aspects of representing rotations of homogeneous polynomials. The connection being that harmonic homogeneous polynomials are solid spherical harmonics. My goal in this note is to rotate solid homogeneous polynomials ( in variables $x$, $y$, and $z$ ) by computing representations of $SO(3)$ on \(\mathcal{P}_d\), homogeneous polynomials of degree $d$. One nice aspect of computing representations of $SO(3)$ is that only algebra is required. Differential equations typically used to describe/derive spherical harmonics make no appearance in what follows. ... read more

Area Forms & Normals

To compute the area form of $S^3$, I used a general formula for $S^n \subset \mathbb{R}^{n+1}$ that I found in Lee’s Introduction to Smooth Manifolds.

\[\begin{equation*} \Omega = \sum_{i=1}^{n+1} (-1)^{i+1} x_{i} dx_0 \wedge \cdots \wedge \widehat{dx_{i}} \wedge \cdots \wedge dx_{n} \end{equation*}\]

is the area form of $S^n$, in terms of its coordinate functions. While trying to understand this formula, I was reminded of the cross product formula, which is an alternating sum of determinants. Well, sure, alternating forms like \(\Gamma_i = dx_1 \wedge \cdots \wedge \widehat{dx_{i}} \wedge \cdots \wedge dx_{n+1}\) are really determinants in disguise. Suppose $v_1, \ldots,v_n$ are tangent vectors at some point on $S^n$. Individually, 1-forms $dx_{j}(v)$ are linear functionals and act on tangent vectors $v \in T_{p}S^n$. Essentially, $dx_{j}(v_k )$ is a portion of the derivative $Dx_j$ in the $v_k$ direction; the directional derivative. Alternatively, it is the action of $v_k$ on coordinate $x_j$. I summarize these two descriptions below. ... read more

Parameterizing the Space of 3D Rotations

3D medical images in the NifTI format store data from MRI acquisitions of some anatomy, like a human brain or heart. When I was a postdoc @Penn my lab was primarily interested in studying brains. Each image associates grayscale values ( in the simplest case ) to discrete coordinates $(i,j,k)$, which describe voxel locations. And for reasons best explained by NifTI FAQ it’s useful/important to align the acquired image to some other coordinate system. This alignment is stored in the image header, as a rigid motion plus an offset. Here’s a bit of NifTI documentation motivating the need to keep the alignment.

This method can also be used to represent "aligned"
coordinates, which would typically result from some post-acquisition
alignment of the volume to a standard orientation (e.g., the same
subject on another day, or a rigid rotation to true anatomical
orientation from the tilted position of the subject in the scanner).

The NifTI standard allows for orientation reversing transforms, but in this post I focus on proper rotations. These rigid motions must preserve volume and orientation; rigidity necessitates linearity. Being a geometric property, volume is preserved when this linear transformation is an isometry; which is to say, for some matrix $A$, $A A^T = I$. Moreover, orientation is preserved when $\det(A) > 0$. The intersection of all these requirements is the group of 3D rotations, usually referred to as the special orthogonal group, ... read more