The standalone version with music can be found here.
Showing posts with label math. Show all posts
Showing posts with label math. Show all posts
Sunday, September 21, 2014
Pascal's triangles in HTML5
I did this animation in Flash long time ago, but I wanted to see it on my iPhone so I ported it to JavaScript using canvas and web audio.
The animation is a Pascal triangle reflected in the X and Y axis, where the empty cells are the numbers that are divisible by some random number (not prime) selected for every drawing pass, and the cells in colors are randomly colored accordingly to their residue by the same random number. The source code has all the nitty-gritty details.
The standalone version with music can be found here.
The standalone version with music can be found here.
Labels:
canvas,
javascript,
math
Sunday, August 24, 2014
Mathematical art
Once upon a time, I considered myself a decent painter. I remember getting second place in some magazine for some Christmas teenagers contest and spending a whole summer painting furiously at my home in the highlands. But, truth be said, I'm awful compared with the professional painters and artists I have found working as a game developer. Most of my art prodigies are forever lost now, maybe for good, but I remember painting something like this when I was entranced on my abstract expressionism period:

Labels:
canvas,
javascript,
math
Sunday, January 5, 2014
IMO 1979 Problem 3
I "solved" another International Mathematical Olympiads problem:
The source code can be found here: http://github.com/ex/js
And the stand alone demo can be viewed here: http://ex.github.io/js/src/imo_1979_3/
There are two circles in the plane. Let a point A be one of the points of intersection of these circles. Two points begin moving simultaneously with constant speeds from the point A, each point along its own circle. The two points return to the point A at the same time. Prove that there is a point P in the plane such that at every moment of time the distance from the point P to the moving points are equal.The demo below draws all the lines that satisfy the condition while the points are moving, if there is such a point P then our lines must intersect in that point.
r (R1/R2)
q [R1 - R2, R1 + R2]
Move
Inverse direction
And the stand alone demo can be viewed here: http://ex.github.io/js/src/imo_1979_3/
Labels:
code,
javascript,
math
Saturday, May 26, 2012
Mandelbrot fractal viewer
One of the first things I did when I got my computer was to render the Mandelbrot Set fractal. This was centuries ago, and I did it in C using DOS Borland-C++ and its fabulous (for me at that time) graphics library. I played a lot plotting lines and points on the screen those days. I don't know why exactly but this program has been always in my heart, maybe due to the colorful images it gave me:

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!
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!
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:
The mathematical solution is left as an exercise, because you can use the brute force Luke. :D
Cheers.
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.
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:
Subscribe to:
Posts (Atom)