Posts

Data science & ML Video Tutorials Part II - Group & Set Theory (Groups, Rings & Fields)

Image
We continue building the knowledge required for basic probability theory and statistics (needed for data science & ML). The videos in this post are about set algebra and algebraic structures like groups, rings & fields. It includes an introduction to identity, inverse and idempotent elements. We'll see that Boolean conjunction and disjunction can be seen as multiplication and addition and investigate possible additive and multiplicative identities and inverses. This is followed by power sets and basic operations on elements of power sets (union, intersection, complement, difference). All concepts are then combined in a discussion of algebraic structures including groups, rings and fields. We end with Boolean rings and describe set algebra as an example Boolean ring. In the review session we complete an example proof from CH1 of W. Rudin's Principles Of Mathematical Analysis using the axioms of a field. Introduction to part II. The main subject of the sessions of Par...

Data science & ML Video Tutorials Part I - Sets, Tuples, Relations & Functions, Basic Boolean algebra

Image
What follows is part I of a series of short instructional videos in mathematics. The videos cover concepts needed for analysis & probability theory. The part I video sessions are embbeded in order below: Intro: Introduction to Part I of a course in mathematics for probability, statistics, data science and machine learning. 1A: The basic concepts of set algebra. Set builder notation, common sets of numbers (natural numbers, whole numbers, rational number, real numbers), subset, superset, universal set & complement. This session is part of a series of math tutorials for statistics, data science & machine learning( ML ). 1B: Introduce tuples, the set Cartesian product, Cartesian triple product and set cardinality. 2A: Define a mathematical relation as a subset of the Cartesian product. Define the inverse relation. Example relations. Position and function input. Continuation of session 1A. 2B: Definition of a function as a special case of a relation. Compare relati...

Finite Difference Simulation of a Helmholtz Resonator - 2D Acoustic Wave Equation

In this project we wish to simulate the acoustics of a Helmholtz Resonator (HR) as may be found in a vented loudspeaker enclosure design. The vent functions as a Helmholtz resonator and has a low frequency attenuation effect. The enclosure is compartmentalized due to the vent design. Therefore, in order to carry out the simulation we must implement reflecting boundary conditions in the interior of the simulation region. In addition, a mixture of absorbing and reflecting boundary conditions are needed at the edges of the simulation region. Absorbing boundary conditions for the wave equation require additional attention and are implemented as described by [Alam & Mohiuddin, 2021]. Read a detailed explanation report can be found here here . The Github project is availabe here: https://github.com/aruymgaart/AMATH/tree/master/acoustic_simulation .

Combination Finite Difference & Spectral Solution to Advection-Diffusion PDE

Vorticity $\omega$ is a measure of local rotation (in a fluid). It is related to the angular velocity of a solid. Vorticity is generally a vector (valued function). However, it can be viewed as a scalar in 2D because it is always perpendicular to the plane. If fluid velocity $\vec{v}$ (in 2D) has components $u$ and $v$ \begin{equation} \vec{v}(t) = \begin{pmatrix} u(t) \\ v(t) \end{pmatrix} \end{equation} then these vector components are related to a scalar quantity called the \textbf{stream function} $\psi$ as follows \begin{align} u = -\psi_y \\ v = \psi_x \end{align} so that \begin{equation} \vec{v}(t) = \begin{pmatrix} u(t) \\ v(t) \end{pmatrix} = \begin{pmatrix} -\psi_y \\ \psi_x \end{pmatrix} \end{equation} So $\psi$ is a scalar valued function while the components of the fluid velocity vector can be derived from it. \begin{equation} \label{eq:hw4_laplacian_eqn} \nabla^2 \psi = \omega \end{equation} Vorticity-Streamfunction PDE \begin{align} \omega_t + [\psi,\omega] ...

MNIST Classification LDA SVM CART & Generalized Eigenvalue Problems

In this UW assignment report we analyze the MNIST handwritten digit dataset. We start with Principal Component Analysis (PCA) for dimensionality reduction and visualization. Visualization of the digits is accomplished by projection on 3 principal components such that each image is represented by a single 3D point. We next build a few supervised classifiers and compare their accuracy. Classification methods explored in this report include Linear Discriminant Analysis (LDA), Support Vector Machine (SVM) and Classification And Regression Tree (CART) used in the classification mode. Read a detailed explanation of MNIST classification with LDA, SVM & CART in terms of eigenvalue problems here . The Github project is availabe here: https://github.com/aruymgaart/AMATH/tree/master/MNIST_classifier_LDA_SVM_CART_582HW4 . Python implementation of DMD:

Video Background Subtraction With Dynamic Mode Decomposition

In this UW AMATH582 assignment we will subtract stationary background from videos of moving objects using Dynamic Mode Decomposition (DMD). We approximate the unknown dynamics with a linear system by organizing the image sequence into two sets related by the linear difference equation allowing us to solve for its matrix by least squares. We then discard the low frequency mode corresponding to the static background. Read a detailed explanation of Dynamic Mode Decomposition and its application to video background subtraction here . The Github project is availabe here: https://github.com/aruymgaart/AMATH/tree/master/video_background_dynamic_mode_decomposition_582HW5 . Python implementation of DMD:

Music Scoring With STFT-Gabor Transform

In this UW AMATH582 assignment report we analyze samples of music and attempt to reproduce guitar and bass music scores from them. In order to accomplish this we carry out a time-frequency decomposition of the signal. For the latter, we make use of the Short Time Fourier Transform (STFT) also called Gabor transform. We use low, high or bandpass filters to isolate the bass or guitar from other sound. Read a detailed explanation of the short time Fourier (Gabor) transform and its application to music scoring here . The Github project is availabe here: https://github.com/aruymgaart/AMATH/tree/master/stft_gabor_music_scoring_582HW2 . Example source code:

DFT Noise Filtering

In this UW AMATH582 assignment we are provided with noisy acoustic submarine positioning data. The data comprises discrete time measurements made at half hour increments organized into a 4D array. Each time frame is a 3D array of cartesian coordinates containing the acoustically detected intensity volume. The data is transformed into reciprocal space by 3D FFT. Averaging the transformed signal increases the signal to noise ratio and allows discovery of the frequency "signature". In reciprocal space, the frequency volume containing the signal remains centered at the same position regardless of time index while the signal position in lab space follows a trajectory. The fixed location of the center frequency in reciprocal space allows placement of a Gaussian filter centered at the central frequency component. Each time frame is FFT 3D transformed, filtered in k space and subsequently transformed back. The resulting denoised echo is now positioned by a simple maximum allowing th...

Fourier Transform of Single Frequency Sines and Cosines

Image
Fourier Transform Of Single Frequency Sines And Cosines The Fourier transform (FT) of function $f(x)$ is defined as follows: $$ F(k) = \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} f(x) e^{-ikx} dx $$ The FT is dervived from a Fourier series in complex notation. The Fourier series expands a function into a weighted set of orthogonal basis functions. In case of the FT, the basis functions are sines and cosines. Sines and cosines are periodic on $2\pi$ meaning that the functions repeat themselves at increments of $2 \pi$. The principle idea is that we can represent most functions as a linear combination - a weighted sum - of sine and cosine basis functions. When a function of time $t$ is Fourier transformed, the components of the FT correspond to frequencies of the basis sines and cosines. Frequency is proportional to inverse time. The FT space is often called reciprocal space. If the function transformed were a function of position $x$, the FT is a function of inverse position. I...

Virus Spread PDE Dynamic Model

The video in this post is the result of a dynamics simulation of virus spread in California. Blue color is susceptible population, red is virus density in the environment and green indicates recovered (presumed immune) population. The model numerically integrates a set of partial differential equations that describe the process of infection, recovery contamination, etc. Population density is from census data. You may wish to use the "full screen" option to get a better view.

Matrix Calculus - Intro

Matrix Calculus Applied math very often involves matrix calculus. It is therefore a good idea to review some matrix calculus basics before diving into project specific solutions. It easier to learn the basics first and they are surprisingly simple to learn. A lot can be accomplished with a few intuitions and some notation. Tensors, matrices, vectors and scalars You can view all of these variables as tensors of differing rank. A rank $0$ tensor is scalar while a rank $1$ tensor is a vector and a rank $2$ tensor is a matrix. $$ \begin{array}{c c c} & tensor \ rank & example \\ scalar & 0 & x\\ vector & 1 & \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \\ matrix & 2 & \begin{pmatrix} x_{11} & x_{12} \\ x_{21} & x_{22} \end{pmatrix} \\ tensor & 3+ &\\ \end{array} $$ Vector and scalar valued functions We are likely all familiar with single valued functions of one variable : $$ f(x) $$ The value of the function $f$ depends on the i...

Guide To Walter Rudin's Principles, 1.17, 1.18 (Proof Details)

1.17: The definitions of an ordered field $F$, for $x,y,z \in F$ [i] $x+y \lt x+z$ if $y\lt z$ [ii] $xy \gt 0$ if $x\gt 0 \land y \gt 0$ Review the basic rules of working with inequalities. 1.18.a. Prove $x \gt 0 \implies -x \lt 0$ $$ \begin{array}{l c} x \gt 0 & \\ -x + x \gt -x + 0 & \\ 0 \gt -x & \end{array} $$ 1.18.b. Prove $x\gt 0 \land y \lt z \implies xy \lt xz$ $$ \begin{array}{l c} y \lt z & \\ y-y \lt z-y & \\ 0 \lt z-y & \\ 0x \lt (z-y)x & (?\times x) \ since \ x \gt 0 \\ 0 \lt zx - yx & \\ yx \lt zx -yx + yx & \\ yx \lt zx \end{array} $$ 1.18.c. Prove $x\lt 0 \land y \lt z \implies xy \gt xz$ $$ \begin{array}{l c} y \lt z & \\ y-y \lt z-y & \\ 0 \lt z-y & \\ 0x \lt -(x(z-y)) & \ since \ x \lt 0 \\ 0x \lt (-x)(z-y) & 1.16.c \\ 0 \lt (-x)z + (-x)(-y) & \\ 0 \lt -xz + (-x)(-y) & \\ 0 \lt -xz + (-(-xy)) & \\ 0 \lt -xz + xy & \\ xz \...

Denseness And The Limit Of A Sequence - An Example

Imagine you are a certain distance from an objective. Lets say this distance is 16 units. You are allowed to make progress toward your objective by cutting the distance in half at any time, as many times as you like. When will you reach your objective? In order to answer this question we must evaluate a limit. But before doing that, we may ask ourselves another question: how many times can we divide the distance? The distance in this case, at each step, is a rational number. A rational number is a quotient of two whole numbers in the form n/m (hence the number system is denoted “Q”). So our problem is within Q, the set of rational numbers. Mathematically we have distance $d=\frac{16}{2^n}$ where n is our step number. At one step $d=8$, at 2 steps $d=4$, and then $2$,$1$,$\frac{1}{2}$,$\frac{1}{4}$, etc. Our progress, one step at the time, is called a sequence (in Q). A sequence means we can denumerate the step number $n$. We can assign an integer number to each step. It turns ou...

Guide To Walter Rudin's Principles, 1.15, 1.16 (Proof Details)

Rudin Principles 1.15.a. Prove: $x \not = 0 \land xy = xz \implies y=z$ $$ \begin{array}{l c} y =y & \\ y = y \times 1 & multiplicative \ identity\\ y = y \times (x \times x^{-1}) & multiplicative \ inverse \ x \times x^{-1} = 1 \\ y = (y \times x) \times x^{-1} & associativity \\ y = (z \times x) \times x^{-1} & substitute \ given \ xy=xz \\ y = z \times (x \times x^{-1}) & associative \ given \ xy=xz \\ y = z \times 1 & multiplicative \ inverse \\ y = z & multiplicative \ identity \end{array} $$ 1.15.b. Prove: $x \not = 0 \land xy = x \implies y=1$ $$ \begin{array}{l c} y = y & \\ y = y \times 1 & multiplicative \ identity\\ y = y \times (x \times x^{-1}) & multiplicative \ inverse \ x \times x^{-1} = 1 \\ y = (y \times x) \times x^{-1} & associativity \\ y = x \times x^{-1} & substitute \ given \ xy=x \\ y = 1 & multiplicative \ inverse \end{array} $$ 1.15.c. Prove: $x \not = 0 \land xy = 1 \imp...

Guide To Walter Rudin's Principles, 1.14 (Proof Details)

Proofs - Rudin Principles 1.14 It is useful to read about Abelian groups first. In particular, review inverse and identity elements. Any book on modern or abstract algebra should cover this. In the field of reals $\mathbb{R}$, prove: 1.14.a. if $ x+y = x+z$ then $y=z$ We need to prove $y=z$ under the condition given. Rudin starts with $y=y$ (although not shown in the text) $$ \begin{array}{l c} y = y & \\ y = 0+y & additive \ \ identity\\ y = (x-x) +y & additive \ \ inverse\\ y = x - (x+y) & associative \ \ property\\ y = x - (x+z) & equation \ \ given \ \ (substitute \ \ x+y = x+z )\\ y = (x - x)+z & associative \\ y = 0 + z & additive \ \ inverse \\ y=z \end{array} $$ 1.14.b. if $ x+y = x$ then $y=0$ Note: this proof asserts uniqueness of the additive identity element. Why can we not substitute $y=0$ right away? We would get $x+0=x$ and prove $x=x$. Rudin says substitute $z=0$ in 1.14.a and follow the same path. So starting with $y=...

Guide to Walter Rudin's Principles Of Mathematical Analysis - Intro

Walter Rudin's principles of Mathematical Analysis is generally considered the de facto standard textbook for the subject. But it is not an easy read. As I am going through several chapters of it, I thought it may be of use to others to post some further details on the material. I am using his third edition textbook. Professor Rudin's style is terse. Although the result is concise and elegant, detailed steps are usually omitted from his proofs. So I plan to post some of those extra details here along with other relevant information. Besides any supplementary info on Rudin's book, I also plan to post on other topics in analysis.