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!

Wednesday, January 28, 2015

Grading Stories: "Cheese Weight" and Thusforthwith

One thing I love about the internet is being able to share stories and moments from everyday life. Here are a couple about something I'm sure other academics will be able to relate to: grading stories.


Cheese Weight

My alma mater enforced mathematical writing guidelines and the use of $\LaTeX$ very strongly. Yet some people, notably non-majors, chose to ignore those guidelines completely and complain when points were taken off for writing. Some people handed in scratch work done in pen on graph paper in consistently gigantic writing. Some people *coughEigenpetercough* printed out the questions in $\LaTeX$... two problems to one page, in landscape form... then did them out by hand in tiny writing. Some people *coughalsoEigenpetercough* did the homework in $\LaTeX$ but omitted large amounts of information to fit every proof-based problem on one side of one page.

Then there are the people with just plain bad handwriting. While grading with a friend, I encountered a homework that exemplified this while grading a core class; apparently, one of the people in the class was secretly a chicken tied to a Ouija board. Here's how it went down.


Me: Hey, do you have any idea what these two words are?

Friend: ..........

Me: It looks like it says "cheese weight".

Friend: It does, but that doesn't have anything to do with the problem.

Me: Can you tell from context?

Friend: .... no.... (to another person) Hey, do you know what this says?

Someone else: ..... looks like "cheese weight"?

Friend: How about you?

Yet another person: I have no idea.

Me: Well, "cheese weight" it is then.


And that's how someone got their work back with "what's a cheese weight?" written as a comment.

Runner-up for best handwriting-related mishap goes to the person who tried to write "I used Professor X's code," but botched the last two letters in "code" in a way that evoked, erm, Little Professor X.

---------------------------------------

Thusforthwith!

As a fan of both analysis and silly things, I can't help but enjoy when they're combined. This story is about a friend who perfected this combination.

My friend, at the time, was taking the same real analysis course I was grading, so I mentioned to him how funny it was when people used archaic connecting words: "thusly", "wither" and the like. From there we started trying to come up with the most ridiculous word. Thenceforth! Thuswith! Whencehence!

So of course every homework I got from this friend had at least one made-up connecting word (despite being typed up quite nicely). This continued without incident, until one day:


Me: This is hilarious! I'm worried about you slipping up and doing it on the test, though.

Him: Why not?

Me: Well... the professor might notice, and you might get docked some points...

Him: Hmm...


Which obviously culminated in him PUTTING FAKE WORDS ON THE ANALYSIS TEST.

And guess what?

THE PROFESSOR DIDN'T NOTICE.

Jesus.

------------------------------------------

Readers, do you have any grading stories? Let me know if anyone tries to pull off using fake connecting words---not everyone may be as lucky!

Monday, January 26, 2015

Adventures in Linear Algebra with the Prismatoy

As the nature of the first few posts here should somewhat suggest, my fiancé and I spend a whole lot of time talking to each other about math. He needs a nom. Let's call him Eigenpeter.

The latest installment of "Peter finds an interesting idea, spends 1 hour worth of whiteboard lecture on representation theory to his algebra-phobic lover and makes a Mathematica toy in 15 minutes" is brought to you by Prismatoy, a cube that can be collapsed into a parallelpiped:






Basically, we wandered into a puzzle store where he picked one of these up and didn't put it down. (We did pay before leaving!)

I like this because, when restricted to any one of the 6 faces, it gives a visualization of the linear transformation
$$\left[\begin{array}{cc}1 & \cos\theta\\ 0 & \sin\theta\end{array}\right]$$
(up to transformations, scaling and unitary operations) with $0<\theta\leq \frac{\tau}{4}$* being the acute angle in the final configuration. You could derive this quickly at home by imagining one face as a unit square, then exploiting some basic trig to find that the transformation maps (0,1) to ($\cos\theta$,$\sin\theta$), (1,1) to ($1+\cos\theta$, $\sin\theta$), and leaves the bottom side of the square unchanged. The above then follows from knowing how the transformation acts on the standard basis vectors for $\mathbb{R}^2$.



Peter noted that the volume of this structure is given by the area of the base times the height, which, in this case, is the determinant of the linear transformation that takes it from cube form to its parallelpiped shape. To demonstrate this, we name the three vectors along the given three sides $\vec{a}$, $\vec{b}$ and $\vec{c}$:



The area of the base is given by $\lvert\vec{a} \times \vec{b}\rvert$---one can see this because
$$\lvert\vec{a}\times\vec{b}\rvert=\vec{a}\vec{b}\sin\theta,$$
which corresponds exactly to the area in the first picture, except the vectors are no longer of unit length. Now recall that $\vec{a}\times\vec{b}$ is a vector perpendicular to both $\vec{a}$ and $\vec{b}$. Taking the dot product $(\vec{a} \times \vec{b})\cdot \vec{c}$ only takes into account the component of $\vec{c}$ that is parallel to $\vec{a}\times\vec{b}$---in other words, perpendicular to both $\vec{a}$ and $\vec{b}$---in other words, the height of the parallelpiped! Hence taking the magnitude of this quantity gives us base times height, which is volume.

But wait, there's more! The quantity $\left\lvert(\vec{a} \times \vec{b})\cdot \vec{c}\right\rvert$ can be written as
$$(\vec{a} \times \vec{b})\cdot \vec{c}=\sum_{i=1}^3\left(\sum_{j=1}^3\sum_{k=1}^3 \epsilon_{ijk}a_jb_k\right)c_i$$
where (in case the reader hasn't seen it before) the Levi-Civita symbol $\epsilon_{ijk}$ essentially acts as the 'opposite' of the Kroenecker $\delta$ function, i.e.
$$\epsilon_{ijk}=\left\{\begin{array}{ll}1 & i=1, j=2, k=3;\ i=3, j=1, k=2;\ i=2, j=3, k=1\\ 0 & i=k=j\\ -1 & \textrm{else}\end{array}\right..$$
Now imagine taking the determinant of the matrix
$$\left[\begin{array}{ccc} \lvert & \lvert & \lvert\\ \vec{c} & \vec{a} & \vec{b}\\ \lvert & \lvert & \lvert\end{array}\right].$$
I won't put the algebra all out here, but calculating the determinant according to the definition and rearranging it will give the previous nested sum. This technique can also be used to prove that
$$(\vec{a} \times \vec{b})\cdot \vec{c}=(\vec{b} \times \vec{c})\cdot \vec{a}=(\vec{c} \times \vec{a})\cdot \vec{b}.$$
Yay! It is now evident that
$$V_{ppiped} = \left\lvert(\vec{a} \times \vec{b})\cdot \vec{c}\right\rvert = \textrm{det}[\vec{c}\  \vec{a}\ \vec{b}].$$
More generally, the determinant of a matrix is a factor indicating what change in volume (or area, or the appropriate dimensional quality) it produces.

EPILOGUE: He spent most of Saturday trying to sketch the manifold of possible shape configurations of this object, then trying to determine whether the set of operations on the toy in SL(3) was a group, then made several demonstrations of these and similar phenomena in Mathematica. However, he did not do the dishes. I cut the lecture for brevity.





*YES, TAU.