Thursday, 29 May 2014

Pizza time!

Yesterday it was my birthday, and apparently it is now customary to write a facebook post saying "happy brthday". I don't usually do that because I know another 500 people are going to do exactly the same thing so I just "like" one of the posts. Doesn't that give the same impression of wishing a happy birthday as the actual post? Anyways... that's not my point here.


The point is, and apparently most of my friends know this, that I was expected to eat a lot of pizza. I guess the regular thing to do is to have some cake, I don't have anything against cake... except chocolate cake. But I can't say no to pizza. My favourite food is pizza and if given a choice pizza always wins. That reminds me that I believe that one doesn't really have a "favourite something" one has a favourite random variable to prefer a favourite something and when asked or forced into selection one generates a sample from that distribution... sort of a quantum preference: at any given time one's preferences are given by a probability distribution and when forced to select, the preference collapses into one single choice, but anyways... that's not my point.


My point is that for me the food preference probability distribution is heavily condensed in pizza. What pizza is a proper statistical question that I won't go into details here but the modes are pepperoni and mushrooms and onion, peppers, olives, and pepperoni. I'm not a nutritionist but I can understand that how if I ate a whole pizza in one night won't be considered a healthy thing. But with the right ingredients, a decent amount, and at a proper time I don't see why it shouldn't be considered healthy. Now I remembered that apparently people are now using interchangeably the terms "vegetarian" with "healthy" which are clearly not necessarily the same thing and even worse the term "organic food" used to refer to food produced with organic pesticides. So now there are tomatoes and organic tomatoes, how ridiculous does that sound? The term organic actually means that is carbon based, but anyways... that's not my point here.


My point is that I believe that pizza once in a while is a healthy thing. Yes, I used to eat pizza every Monday and Tuesday and I did this for a whole year... not healthy at all, but I now have healthier habits. That reminds me that now every time I go back to Mexico it is actually weird to drink still water, and I mean plain still water. Although one of my fattest friends has been doing this for a long time, and there was even a time in which he wasn't fat and went running with us every weekend. I don't know what happened to him... but that's not my point here.


To be honest, I don't think I have a point in all these. So if you want to have a pizza, be my guest. By the way, there are several maths related pizza problems out there. Here's one... I might find some more problems later on...

Tuesday, 20 May 2014

Stats and exams

I haven't written poems in quite a while,
So now that I'm exams invigilating
A task that, trust me, is seriously boring
I'll write a couple of rhymes just to kill time.

Finding the means, variances, covariances,
Probabilities through normal approximations,
And all sorts of weird calculations,
All with symmetric positive matrices.

I now sense one of my student's freaking out
Watched her test, she's not even in problem five!
But right now I can answer her no doubt

Told her to breathe slowly, think, hold on and strive,
And although she's about to cry and shout,
From exams one always walks away alive.

saint_curious_george

Sunday, 18 May 2014

Die Sprache

Die meisten meine Beiträge sind in Englisch weil sie die einfachsten Sprache ist. Die Welt spricht Englisch! Ich finde Englisch eine cool Sprache. Ich mag ihr. Aber ich mag Deutsch mehr und ich brauche mehr praktiziert. Ich soll auf Deutsch mehr schreiben.

我能写一点儿汉字可是我的中文是不好。 我会写在汉字一个post, 可是不今天。



So while I get more confident with my German grammar, I will keep writing in English most of the time. Trust me, I'm working on that, I already have three books in German, two films, and I'm taking my Duolingo exercises seriously... I even listen to the news every morning from Die Tagesschau and I have become a huge fan of theses videos from Kurzgesagt, which are also in English, so give them a try.



Por supuesto que de vez en cuando quiero escribir en español, pero siento que es del que menos práctica necesito. Lo que sí es que siempre me han generado interés los diferentes idiomas. Dejo aquí la versión que más me gusta de la canción de Frozen. ¡Si no han visto la película... no saben nada!

Monday, 12 May 2014

Stolen bikes

There's no clearer proof of the existence of people who suffer a total lack of empathy than those who take the result of others' hard work without remorse.

It is true, life is tough. It has been like that since the very beginning. Being a species on this planet requires one to have a flawless streak of surviving predecessors and the will to do whatever it takes to stay in this world. There was a time when this meant being aware of predators, take the changes of the merciless weather, gather some food, and outlive the competitors. Today it also means surviving the cruel capitalist system and obey man made laws or not get caught by the judicial system.



Any given random bloke is born under certain circumstances under our system, and, yes, climbing up the ladder of the social pyramid is not easy at all especially if one is in the lowest floors. But that doesn't mean that one should be nice to others, does it? 

I've been thinking about this because just recently one of my best friends got mugged and her phone and her just bought new bike was stolen, the very same day she bought it! Her birthday! What a way to celebrate...

Of course I don't know the perpetrator's conditions but I can't but think that that was wrong and low. Fortunately she is doing fine and she wasn't hurt, I can even say that taking the bike and the phone from her is not even a bad thing. But what it is terrible is the fact that one doesn't know when someone is going to be willing to do some harm just to take some material property.


I believe we shouldn't be worried of members of our own society. I'm not a philosopher and I'm certainly not a 100% deontologist but I like Kant's idea on the categorical imperative: always act in such a way that you can also will that the maxim of your action should become a universal law. What I get from this is that one should do as one would like others to do. This exact same statement is even in the Bible! Quoting Matthew 7:12 "So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets." Agreeing that this is what we would call a good thing, and following Thomas Aquinas's synderesis principle as stated in his Summa Theologica "that good is to be sought and done, evil to be avoided" I think is pretty much clear that stealing bicycles is not the moral thing to do.




Personally the worst part for me is that I feel complete and utterly useless when something happens to my friends that live on the other side of the world because I cannot help them. So yes, do act as Captain Steve Rogers would but remember that not everybody is following the same moral code. Take care.

Sunday, 4 May 2014

Las estampitas del mundial

Cada 4 años el planeta celebra el mundial de football. El mundial. La Copa FIFA. Yo tengo pésima memoria, pero recuerdo claro la primera vez que puse atención a un mundial. Fue en Italia'90 aunuqe el anterior había sido precisamente en México'86, lástima que era demasiado joven en aquel entonces porque no me acuerdo de nada... mucho menos de España'82.


Aunque Italia perdió, me volví fan del football, del idioma italiano, de la comida italiana y con ayuda de las tortugas ninja adolescentes mutantes... de la pizza.


Después de Italia vinieron USA'94, en el que Italia volvió a perder en la final contra Brasil y desde entonces odio que ellos ganen. Luego vino Francia'98, en el que los frances debieron haber perdido contra Paraguay pero un poco de suerte los ayudó. Desde mi perspectiva no jugaron muy bien sino hasta la final precisamente contra Brasil. Si algo me gustaba menos que Brasil ganara en el football en aquel entonces es que ganara Francia. Durante la preparatoria tuve que tomar clases de francés e independientemente de que no me gusta el idioma y no era buen alumno, mi maestra era de esas típicas de "Pongan atención, esta situación es lamentable, por eso el país está como está. Los niños en Francia sí ponen atención en clase." Situación que era bastante molesta. Terminamos entre broma y broma odiando todo lo que tuviera que ver con Francia... asún así Francia ganó el mundial.

En Corea-Japón 2002, ya estaba en la universidad y los partidos eran a los 2 o 3 de la mañana... era algo complicado verlos pero aún así los veíamos. Alemania 2006 fue increíble, por fin Italia ganó además gané la quiniela de la oficina donde trabajaba y básicamente me estuvieron pagando por ver partidos del mundial diario. Literalmente los vi todos, tenían SKY en la oficina. Pensé que en mi evaluación me iban a correr porque no había hecho nada, pero lo sorprendente fue que me fue muy bien... después me di cuenta de que mi jefe era un barco, siempre me fue bien en mis evaluaciones.

Suráfrica 2010 fue el mundial que prácticamente vimos en mi depa. En uno de mis ataques de compras compulsivas compré una pantalla de 50 pulgadas, originalmente para jugar Street Fighter IV, pero sirvió para invitar a la banda a ver los partidos. La final fue Holanda vs España, yo le iba a Holanda porque los españoles le habían ganado a los alemanes que habían jugado muy bien todo el torneo salvo contra el partido contra España. España ganó, pero en un partido lamentable. Si yo hubiese sido el presidente de la FIFA en aquel entonces hubiera declarado que los dos perdían y no hay campeón. Además Holanda aplicó la legendaria "this is Sparta!"... una cosa lamentable, como diría Martinoli.


Ahora el mundial será en Brasil 2014. Personalmente veo al equipo mexicano muy mal, la vez pasada era mucho más fuerte pero una clara decisión técnica contra Argentina los sacó del partido. Hay cosas que nadie entiende, esta es una de esas. Pero la verdad es que ahora no sé que decir de los equipos porque normalmente llenar el album de estampitas de Panini me ayudaba a conocer a los jugadores y estudiar cómo estaba jugando cada país. Este año no lo llené, así que voy a tener que adivinar.


Ya lo he mencionado en posts anteriores, pero este semestre que acaba de terminar di clases de procesos estocásticos, así que me vino a la mente la siguiente pregunta: ¿Cuántos sobrecitos hay que comprar para llenar el album del mundial?

Para contestar esta pregunta se me ocurrió plantearlo de la siguiente manera. Supongamos que para llenar el album se necesitan $N$ estampitas. Un sobrecito tiene consigo $n$ estampitas diferentes de esas N. Si decimos que $X_t$ es el número de estampitas distintas que ya conseguimos en nuestro album después de haber comprado $t$ sobrecitos, entonces la secuencia $\{X_t\}_{t\geq 0}$ es una cadena de Markov con epacio de estados $\{0,1,2,\ldots,N\}$, distribución inicial $\mathbb P[X_0=0]=1$ y matriz de transición $P$ con elementos $p_{k,j}$ definidos como:
\[p_{k,j}=\frac{\binom{N-k}{j}\binom{k}{n-j}}{\binom{N}{n}}\]
siempre que $1\leq n\leq N$, $0\leq k \leq N$ y $0\vee (n-k)\leq j \leq n\wedge (N-k)$ o $0$ en cualquier otro caso. Uno de mis alumnos de hecho reconoció esta fórmula como la distribución hipergeométrica. El porqué esta fórmula es la buena es un problema de conteo y combinatoria que no quiero explicar, pero viendo la fórmula e interpretando cada uno de los factores no es difícil convencerse de que en efecto así es.

Con estas definiciones ahora nos fijamos en la variable que nos interesa: el número de sobrecitos que necesitamos para completar la colección. Pero hay veces que en matemáticas resulta más fácil resolver más problemas en lugar de sólo uno. Esta es una de esas ocasiones, así que consideramos todas las variables que son: si ya tenemos $j$ estampitas, el número de sobrecitos que necesitamos para llenar el album son:
 \[T_j=\inf\{t\geq 0:X_t=j\}\]
El que nos interesa es $T_N$, si no tenemos estampitas y queremos llenarlo. Esto es un n[umero de sobrecitos aleatorio, pero bueno, podemos preguntarnos, ¿cuál es el número de sobrecitos esperado? De otra forma ¿cuál es el número de sobrecitos promedio que los coleccionistas compran para llenar el album? Definamos estos números así: \[y_k=\mathbb E[T_N|X_0=k]\] y no es compicado darse cuenta de que satisfacen estas propiedades:

$y_N=0$ porque si empezamos de un album lleno, no necesitamos más sobrecitos para llenarlo. Pero si no está lleno, entonces necesitamos al menos un sobrecito más y dependiendo de cuántas estampitas nuevas tengamos necesitamos el número esperado de sobrecitos que se necesitan estando en esa nueva posición.

\[y_k=1+\sum_{j=0}^np_{k,j}y_{k+j}\]

Esto da un sistema de ecuaciones:

\[y_k=\frac{1+\sum_{j=1}^np_{k,j}y_{k+j}}{1-p_{k,k}}\]

Mis métodos análiticos dan hasta aquí sin clavarme mucho. Bueno no, en el caso de que $n=1$, es decir, si nada más viniera una estampita por sobre, se puede probar que
\[\lim_{N\rightarrow\infty}\frac{y_0}{N\log N}=1\]
Pero no se me ha ocurrido cómo generalizar este resultado cuando $n\geq 2$. En nuestro caso, $N=410$ porque el album tiene 648 estampitas y $n=5$ porque vienen 5 estampitas por sobre.

Los resultados que se me hicieron interesantes son por supuesto, que el número esperado de sobrecitos es de 911 y si sólo te falta una estampita es de 130. Creo que en México el sobrecito cuesta 6 pesos... esas matemáticas ya las pueden hacer ustedes.


Por cierto, para resolver el sistema, usé unos códigos en R, se los dejo en este link por si tienen mucho tiempo libre.