Wednesday, February 25, 2015

The 6 Stages of Math Writing

Here's some news! I've decided to devote all of March to the basics of distributional calculus. In undergrad, I had a professor that taught distributional calculus from a purely theoretical standpoint and refused to match this with intuition, so this will be an adventure in explaining math for me as well.

It goes so well with the blog title---we're the Analyisisters! Let's throw some analysis at everyone!

In the meantime, sit tight while I pretend to be Seinfeld.

How would you write out the solution to this problem at each stage of university life?

Let $A$, $B$ be matrices in $\mathbb{R}^n$. If $AB = I$, then $A^kB^k=I$ for all $k \in \mathbb{N}$.

LEVEL 1: FROSH

\begin{align}
B^kA^k &= B\ldots BBAA\ldots A\\
&= B\ldots BIA \ldots A\\
&= B \ldots BA \ldots A\\
&= B \ldots BIA \ldots A = I
\end{align}

Yes, I know math homework is supposed to be written in complete sentences, but, why bother? I'm the chosen one who will be able to understand what this means 12 years later.

I mean, come on. I understand it right now. It's really easy.



LEVEL 2: SOPHOMORE

$BA = I$. Then $B^{k+1}A^{k+1} = B^kBAA^k=B^kIA^k=B^kA^k=I$.

Oh, you were serious about that sentence thing? And the sentences have to end with periods? Are you sure? Okay.

Hey, are you going to take points off if I don't put it in a sentence? Why are you doing that? I didn't know that was going to happen.



LEVEL 3: JUNIOR/LAZY GRAD STUDENT

We know that $BA=I$. Suppose $B^kA^k=I$. Therefore,
\begin{align}
B^{k+1}A^{k+1}&=B^kBAA^{k}\\
&=B^kIA^k.
\end{align}Therefore, using the properties of the identity, $B^{k+1}A^{k+1}=B^kA^k = I$. Therefore, this proves our statement.

They'll never guess my favorite connecting word.



LEVEL 4: SENIOR/GRAD STUDENT

This can be solved using induction. We are given that $BA = I$, providing the base case, so we suppose that $B^kA^k = I$ to show that $B^{k+1}A^{k+1}= I$. We then find that
\begin{align}
B^{k+1}A^{k+1}&= B^kBAA^k\\
&= B^kA^k = I,
\end{align}as desired.

Wow, can you believe how I wrote as a frosh? Who even thinks that's okay? I guess that it shows that I know how important math writing is. That.



LEVEL 5: PERFECTIONIST GRAD STUDENT

We proceed inductively with the given base case $BA=I$. Suppose $B^kA^k = I$ towards demonstrating $B^{k+1}A^{k+1}$ to be the identity as well. Using the definition of integer exponents and both given/inductive hypotheses, we conclude
$$B^{k+1}A^{k+1}=B^kBAA^k=B^kA^k=I;$$that is, the conditions of induction are satisfied and the original statement follows. This fact can be used to show equivalency of left and right inverses (i.e., $AB = I$ iff $BA = I$ for square $A,\ B$ of concordant dimensions).

Varying sentence structures, excessively clear logic, weird punctuation marks, parenthetical statements. Look! Revel in my competence! Feel the 2 hours I spent formatting the answer until it was textbook perfect!

Do you want to see my personalized LaTeX class with a multi-page macro set designed specifically for this field? I made it while my friends were at the bar.



LEVEL 6: PROFESSOR/VERY CONFIDENT GRAD STUDENT

Given $BA=I$ as the inductive hypothesis, observe that
$$B^{k+1}A^{k+1}=B^kBAA^k=B^kA^k=I$$implies the above.

There's no way I'm spending more than 5 minutes on this trivial problem. Why are you even showing it to me? I have several papers to review and two classes to prepare for. This it pointless.



Stay tuned next week, where we do absolutely nothing funny and go down the rabbit hole of formal math! (I need to update my macro set.)

Monday, February 23, 2015

Rolling Shutter + Moving Things = WICKED

There is a point in every blog's life where the audience and niche becomes set in stone, a point which this blog seems to be quite far from reaching. Do I go through the proof of Hölder's Inequality with informal language and cute pictures? Or, instead, simple mental math tricks that everyone alive should know? A smattering of recent interdisciplinary papers I have opinions on, or stories of working with high school and middle school tutees? Macros in $\LaTeX$? Householder reflectors? That time I found out biologists use "units" to refer to a different quantity for every substance?

So here we fall back on the old "what is Peter up to" shebang, which is never not funny. I feel truly blessed to have a partner who spends hours looking at fluid dynamics in bubble solution and can spell his initials in a 9x9 puzzle cube. The fields he finds interesting (look at all the things prime numbers can do! pretty pictures!) are also more accessible to laypeople than the fields I find interesting (okay, now memorize definitions for 2 years! in two more years you will be able to appreciate distributional calculus!). Maybe that's why there are so few famous analysts.

The biggest fight we ever had was over his finitism. He tried to convince me it was silly to model reality using irrational numbers that can't be described using a finite amount of information; I sat on the bed sobbing because the axiomatic structure he was proposing didn't have a clear measure, and so how do sets get mass, and HOW DOES INTEGRATION WORK IN YOUR CRAZY WORLD? DON'T YOU CARE ABOUT THEORETICAL JUSTIFICATION? HUH?!

Pictures, right? Everyone likes pictures?

Some background: this particular incident occurred when Peter discovered his cellphone camera took pictures by storing data from the top down, so that the photos were separated into horizontal lines that were actually taken at different times. (Wikipedia assures me this is called rolling shutter.) Usually, this doesn't make a difference---unless if one were to take pictures of something spinning or vibrating really fast.

So of course that's what he did for a whole week.

Here's what his mom's spinning flamingo looks like in real life:

video

... but with a rolling shutter, it's a curved monstrosity... 



An ordinary fan looks like it has vertical blades:


video



Bouncing balls show deformity:


And, for our personal favorite, filming a cello gives a visualization of the old $u_tt = c^2\nabla^2u$:


video






All things considered, it wasn't a bad way to spend a week.

 Got these? Share 'em!

Wednesday, February 18, 2015

Convexity and You: Unpacking the Definition

Real Analysis is notorious for taking easy-to-understand concepts and repackaging them in a thick theoretical barrier. Take the epsilon-delta definition of continuity---it's impossible to prove anything with the information "the function, uh, doesn't have any holes," but it's impossible to develop a mental picture given only the theoretical perspective. For this reason, one of the biggest barriers to learning any type of analysis is properly connecting the intuitive idea and the theoretical representation.

We'll focus here on one of the less transparent definitions: convex functions. Convex functions can be understood intuitively as "the area above the function is a shape that doesn't go inwards on itself"... and theoretically as
Given convex set $X$, a function $f:X\to\mathbb{R}$ is convex if for all $x_1,\ x_2\in X$ and $t \in [0,1]$, $f(tx_1+(1-t)x_2)\leq tf(x_1)+(1-t)f(x_2)$.
What.

This is the part where, during an analysis course, you are expected to nod your head at the alphabet vomit (at least this time it's the Roman alphabet, not the Greek, that tossed its cookies). Let's make some sense out of what information is being conveyed.

First of all, to understand the definition of convex functions, you must know what convex sets are. A set is convex if any two points (call them $x_1$ and $x_2$) can be connected by a straight line that is contained in the set. If the set is not convex (i.e. "goes inwards" visually), then there will be at least two points whose connecting line goes outside the set.




Now the domain of $f$ is a convex set $X$, which should explain what the points $x_1$ and $x_2$ are doing in the definition: they correspond to the two arbitrary points that we want to try and connect with a line. This brings us to the purpose of defining $t \in [0,1]$. Consider the function $y(t)=tx_1+(1-t)x_2$. Since $y(0)=x_2$, $y(1)=x_1$ and $y$ itself is a linear functional, this function represents a straight line segment starting at $x_2$ and ending at $x_1$. Thus the purpose of $t$ is to create the parametrized line segment joining points $x_1$ and $x_2$.

We are given that $X$ is a convex set, so it is certainly true that the line $tx_1+(1-t)x_2$ is completely contained in $X$, the domain of $f$. This makes it completely legit to consider $f(tx_1+(1-t)x_2)$ as the image of this line. The image of a straight line in the domain won't necessarily be a straight line itself, but will instead be a path along the function starting at $f(x_2)$ and ending at $f(x_1)$. Hence the expression $f(tx_1+(1-t)x_2)$ is asking us to consider the section of $f(x)$ that connects* $f(x_1)$ and $f(x_2)$.

This brings us to the last part of the inequality
$$f(tx_1+(1-t)x_2)\leq tf(x_1)+(1-t)f(x_2).$$
Just as before, the second expression $tf(x_1)+(1-t)f(x_2)$ is representing a parametrized line segment, joining the points $f(x_2)$ and $f(x_1)$. We are now comparing two paths between $f(x_1)$ and $f(x_2)$: one is a straight line, and the other a path on the function. The inequality places a lower bound on where the straight line can be. If the straight line is above the path on $f$ everywhere---that is, if it satisfies the above inequality---it is contained in the area above $f(x)$ (the epigraph of $f$).

That's exactly the definition of a convex set, but applied to the space above $f$... cool.

Here's a picture for $X = \mathbb{R}$:


That's what the definition is communicating. I hope that was insightful for someone!




*(does not refer to connectedness in the mathematical sense)

Monday, February 16, 2015

Solving the Spider Problem

A few days ago, while searching for tweets containing the word 'math', I came across this problem:


Who wouldn't attempt to solve it after that commentary? Poor spider, though. That must have been tiring.

I'm certain any readers would want to attempt this for themselves as well, so my solution (and the accompanying story!) can be found after the jump break.

Wednesday, February 11, 2015

Mathematical Words in Different Languages (Pt. 2 - Armenian!)

Hello all, and welcome to my inaugural Analysisters post! This will be a short one, just expanding upon Tuesday's Math Words post in the only language I know well enough to write about -- (Eastern) Armenian. Also, apologies for the slight tardiness, as this Analysister resides on the West Coast, and is also allergic to deadlines.

Here is a list of common math words, translated into Armenian, and then transliterated in the way I was taught. Since the Armenian alphabet has 39 letters, there are several common mappings from the Armenian to English alphabets, not even taking into consideration different dialects. Thus, if there are discrepancies, that is probably the reason. So, without further ado...


English Armenian Transliteration
Mathematics Մաթեմատիկա Matematika
Theorem Թեորեմ Teorem
Lemma Լեմմա Lemma
Proposition Դատողություն Dataroghutyun
Definition Սահմանում Sahmanum
Proof Ապացույց Apatsuyts
Open Բաց Bats
Closed Փակ Pak
Algebra Հանրահաշիվ Hanrahashiv
Integral Ինտեգրալ Integral
Differential Դիֆերենցիալ Diferentsial
Geometry Երկրաչափություն Yerkrachaputyun
Function Ֆունկցիա Funktsia
Finite Սահմանափակ Sahmanapak
Infininte Անսահման Ansahman
Countable Հաշվելի Hashveli
Uncountable Անհաշվելի Anhashveli
Physics Ֆիզիկա Fizika

That's all for now. As always, comments are welcome.

Monday, February 9, 2015

Mathematical Terms in Different Languages (Pt. 1)

Readers, all both of you, I apologize. Not a whole lot happened this week in terms of math (aside from Project Euler, which is like the fight club of math-CS in that they share a set of rules. NEVER TALK ABOUT PROJECT EULER.) While my fiancé and I usually find something interesting to talk to each other about once a week, I spent the last week (+ two months) moping about job searching and he spent over 7 hours yesterday doing side quests in FFX. So here's a fun fluff piece.

Common mathematical terms in different languages!

(I apologize in advance for my preference of languages using the Roman alphabet. This is in no way meant to suggest that people speaking the following languages have made more significant contributions to math than people speaking languages that are not included, and is instead a side effect of the compiler's inability to read these alphabets, thus preventing error-checking. I'll be happy to add languages if anyone with better language skills wants to help!)

Corrections by fluent speakers are welcome. Note: when a word has multiple meanings, we are looking to specifically choose the one that relates to the mathematical concept.


English Spanish French German Hungarian
Mathematics Matemáticas Mathématiques Mathematik Matematika
Theorem Teorema Théorème Theorem Tétel
Lemma Lema Lemme Lemma Lemma
Corollary Corolario Corollaire Korollar Következmény
Proposition Proposición Proposition Aussage Állítás
Definition Definición Définition Definition Definíció
Proof Demostración Démonstration Beweis Bizonyítás
Open Abierto Ouvert Offene Nyílt
Closed Cerrado Fermé Abgeschlossene Zárt
Continuous Continuo Continu Stetig Folytonos
Differentiable     Derivable Dérivable Differenzierbare Differenciálható
Analytic Analítico Analytique Analytisch *
Integrable Integrable Intégrable Integrierbar Integrálható
Function Función Fonction Funktion Függvény
Set Conjunto Ensemble Menge Halmaz
Space Espacio Espace Raum Tér
Dimension Dimensión Dimension Dimension Dimenzió
Group Grupo Groupe Gruppe Csoport
Finite Finito Fini Endlich Véges
Infinite Infinito Infini Unendlich Végtelen
Countable Numerable Dénombrable Abzählbar Megszámlálható
Uncountable No numerable Non dénombrable  Überabzählbare Megszámlálhatatlan
Polynomial Polinomio Polynôme Polynom Polinom
Calculus Cálculo Calcul Infinitesimalrechnung  Számítás*
Limit Límite Limite Grenzwert Határérték
Series Serie Série Reihe Numerikus sor
Sequence Sucesión Suite Folge Sorozat
Convergent Convergente Convergent Konvergent Konvergens
Divergent Divergente Divergent Divergent Divergens
Derivative Derivado Dérivé Derivat Derivált
Integral Integral Intégrale Integral Integrál


Stay tuned for Part 2, in which another Analysister helps out with Armenian!

(* We aren't sure/can't find a dedicated word.)

Wednesday, February 4, 2015

Taken's Theorem and Dynamic Correlation

As much as I dislike regurgitating content instead of producing it, this Sugihara et al. paper is possibly the coolest thing I have ever seen, and has been for a couple years now.

Since MathJax (what we are using to format everything in $\LaTeX$) probably doesn't have BibTeX support, I'm going to go ahead and do an academic no-no by just providing the link to the paper, and no citation[1].

The goal of this paper is to introduce a new method, convergent cross mapping (CCM), a test meant to help determine whether one event in a nonlinear system causes another. As the introduction notes, two populations interacting nonlinearly can go through phases where the behavior is similar, they behave oppositely, or there appears to be no relation. This makes applying traditional measures of correlation or causation useless in such situations.

Enter Taken's theorem: a theorem stating (in extreme layman's terms) that it is possible to 'reconstruct' a chaotic attractor using one of its components. WHICH IS SO COOL. Sugihara et al. concluded that if two components were members of the same system, they would not only be able to reconstruct the original system, but one component would predict the behavior of the other. Hence the 'nearest neighbors' to a data point in the first component should be associated timewise with the nearest neighbors to the corresponding data point in the second component, providing the systems are related, and this predictive ability should get better as more data are taken into account. This is the gist of CCM, which is explained more clearly below and in the paper.

What happens when this method is applied to real data on sardine and anchovy population? Read the paper to find out! If you're a member of the general public, it's less intense and more explanatory than math papers generally tend to go, and a great read if you're even a tiny bit into population ecology. (Not a whole lot is said on the exact implementation, but the numbers they're getting look like correlation coefficients between a variable and its nearest-neighbor estimate as more data is added. I should try to do this in MATLAB and post code.)

Did I mention the videos? George Sugihara's son made two brilliant videos to illustrate where the idea came from. (I want to be his friend.) Here's one on Taken's theorem:



There's also one demonstrating the manifold reconstruction:



Lastly, a brief description of how CCM works:


Yeah. I'm not kidding about this being the coolest thing ever!

I learned of this paper during a talk George Sugihara gave in 2013. Of course, the videos are very pretty, but the topic also illustrates something bigger: how applied mathematicians can make breakthroughs by studying "useless" theoretical topics. Some of my old professors were fond of claiming all pure math eventually becomes applied math. This is a great recent example of such creativity; who would have expected Taken's theorem to relate to causality in ecosystems?

Theory: it's what separates us from the engineers! Or just another excuse for the applied folks to read analysis textbooks.



[1]... Nope, my heart won't let me do it. Here's the citation:
Detecting Causality in Complex Ecosystems. George Sugihara, Robert May, Hao Ye, Chih-hao Hsieh, Ethan Deyle, Michael Fogarty, and Stephan Munch. Science. 26 October 2012: 338 (6106), 496-500. Published online 20 September 2012 [DOI:10.1126/science.1227079]

Monday, February 2, 2015

How I Learned to Stop Worrying and Love Fminsearch

(I'd intended to write a post on subsets of null sets that are not null sets, but some lovely person has already posted it on Wikipedia!)

My field involves a lot of fitting ODE parameters to experimental data, so, as expected, I have a long and storied relationship with distance minimization algorithms.

Particularly fminsearch, MATLAB's built-in Nelder-Mead simplex direct search function.

If a network executive decided for some reason to make a sitcom based on my life, fminsearch would be the lovable goofball character whose laziness is the basis for many a cheap joke.

"FMINSEARCH!!! Stop watching football and clean up all those Funyun wrappers from off the floor!" I'd scream. To which fminsearch would reply, "I can't see them! They're not contained in my initial simplex!" Oh, fminsearch....

Fminsearch is great for converging exactly to local minima, but suffers in a couple ways, the main problem being its inability to detect global minima outside its starting range. This problem arises because the underlying algorithm is local (operates on a closed subset of parameter space) and deterministic (will return the same best fit every time if options/initial conditions are unchanged). Of course, the easiest fix is then to pair it with a global, nondeterministic fitting algorithm such as MCMC (Markov Chain Monte Carlo methods) or a genetic algorithm. The new hybrid algorithm then at least has a chance of breaking out of local minimum wells. However, fminsearch is much better at converging exactly to local minima, so it's a good idea to run fminsearch at the end, just in case.

A similar issue occurs minimizing over several parameter values. Although it is possible to use fminsearch to optimize several parameters at once, my advisors and I have had more luck fitting one parameter at a time iteratively. Beware! The order in which the parameters are fitted has a huge effect on the outcome. Less sensitive parameters may not change much if they are fitted last, and if two parameters are related by dependence, it can be difficult to fit them separately. I've had more luck implementing MCMC with Latin Hypercube Sampling (LHS).

Lastly, it can be difficult to find a local minimum in which constraints on parameter size are satisfied (for example, if the algorithm keeps assigning a negative value to a parameter that shouldn't be negative). This is again a situation that should be passed to MCMC, because reducing the average step size in parameter space will cause parameter values to stay closer to the initial conditions. Another 'cheating' fix would be to alter your distance function to output absurdly high numbers when a parameter value enters the no-no range---this is probably the best way to go if you want to stick with fminsearch.

These are, at a broad level, the most important things I've learned in my years of practically dating fminsearch. I'm cataloging them here in case someone looking for guidance can be spared a few couple fights with my favorite MATLAB function.

If any readers (ha, ha) want me to post some iterative fminsearch or MCMC code, I would be happy to provide a watered-down version!