Monday, February 1, 2010

The Pascal's triangle

It was already time to change the animation for this blog, (the little thing at the right, now with a chess board), so I would do a very short description of the previous one here:

This animation is just a Pascal's Triangle (reflected in the four quadrants) with different colors for cells accordingly to their modules with some random number not prime that changes with every iteration. The triangle for the next iteration is drawn row by row, while the previous one is faded. Empty spaces are cells that are divisible by the selected random number.

If you feel more interested, you could check the section 2.3 of the book Chaos and Fractals (Springer) that gave me the inspiration for this. NOTE: I updated this animation to use canvas HTML5 but the old Flash source code is here

Have a nice night!

Thursday, January 7, 2010

Simulator for a basic computer

This is simple simulator for the basic computer described in the book of Morris Mano "Computer System Architecture". Here professor Hyunsoo Yoo maintains a succinct but complete description of this computer, check it if you can't find the book. In special look for the lectures 5 (Basic Computer Organization and Design) and 6 (Programming the Basic Computer) that this simulator uses as foundation.

Sunday, August 2, 2009

Very very simple interpreter in Flex

This weekend I've been playing with making a very very simple interpreter in Flash, mostly for drawing functions of the form: z = f(x, y). This is based in the part 4 of the famous Lets build a Compiler! tutorial by Jack Crenshaw.


Saturday, July 11, 2009

Solving simple International Mathematical Olympiad problems.

Solving simple International Mathematical Olympiad problems by programming is a sadistic stress reliever. They were originally thought to be solved using only paper, pencil and lots of young and smart neurons. Let's amuse ourselves solving them with a bit of code. Afterall, Why not to use the nukes? :D

Sunday, July 5, 2009

IMO 1959 Problem 04

The year is 1959. The place: Braşov, Romania, where the first International Mathematical Olympiad is being held. The problem is short, simple and sweet:
Construct a right-angled triangle whose hypotenuse c is given if 
it is known that the median from the right angle equals the 
geometric mean of the remaining two sides of the triangle.

The mathematical solution is left as an exercise, because you can use the brute force Luke. :D




Cheers.

Friday, July 3, 2009

Particiones enteras

Celebrando el hecho de que ya termino con mi primer ciclo de la maestría, y que ademas he conseguido el titulo de experto en ProjectEuler haré un post acerca de un problema que me parece interesante. El enunciado es bien simple:

Dado un numero entero "n" ¿De cuantas maneras diferentes se puede descomponer "n" en números enteros positivos?.

La solución aunque simple no es evidente.
Por ejemplo, sea n = 4.
4 puede descomponerse en: ( 1 + 1 + 1 + 1 ), ( 1 + 2 + 1 ), ( 3 + 1 ), ( 2 + 2 ) y ( 4 ). Cada una de estas sumas es una partición entera de 4. Como buscamos solo particiones diferentes hay algunas que no se consideran, por ejemplo, no se esta considerando ( 2 + 1 + 1 ) porque es lo mismo que ( 1 + 1 + 2 ) si ignoramos el orden.
Es fácil entender de donde viene el nombre de partición entera, lo que estamos haciendo es "partir" el numero 4 en agrupaciones diferentes:
Vemos que el numero de formas diferentes en que se puede descomponer 4 es 5.