Omnimaga

General Discussion => Other Discussions => Math and Science => Topic started by: AngelFish on July 21, 2011, 02:11:49 pm

Title: The Beauty of Mathematics
Post by: AngelFish on July 21, 2011, 02:11:49 pm
As most of us are know, mathematics can be very brutal and ugly, especially when dealing with algebraic equations. Here are a few of its prettier sides.

Warning: the images in spoilers are large.

This image was generated during a search for a more efficient way to compute A Mod B. It's a plot of the error between the true answer and my approximation over all possible 16 bit operands. I'm not sure why the resulting graph is so complex given the simplicity of the underlying function, but the remarkable self-similarities and other fractal qualities make it interesting.

Spoiler For Spoiler:
(http://img.removedfromgame.com/imgs/graph.png)
Spoiler For Atrocious Mathematica code to generate the image:
Quote
t=2^8;
TestMod[k_,b_,y_,x_]:=Mod[k,b]-Mod[k-y,b-x];
Array1=Array[0&,t^2];
Array2=Array[0&,t^2];
Array3=Array[0&,t^2];
Array4=Array[0&,t^2];
j=0;
For[b = 1, b < t, b++,

For[k = 1, k < t, k++,
y=k;
x=b;
x=BitOr[x,BitShiftRight[x,1]];
x=BitOr[x,BitShiftRight[x,2]];
x=BitOr[x,BitShiftRight[x,4]];
x=BitOr[x,BitShiftRight[x,8]];
x=BitOr[x,BitShiftRight[x,16]];
x=x-BitShiftRight[x,1];

y=BitOr[y,BitShiftRight[y,1]];
y=BitOr[y,BitShiftRight[y,2]];
y=BitOr[y,BitShiftRight[y,4]];
y=BitOr[y,BitShiftRight[y,8]];
y=BitOr[y,BitShiftRight[y,16]];
y=y-BitShiftRight[y,1];

Array1[[t*(b-1)+k]]=Mod[k,b];
Array2[[t*(b-1)+k]]=Mod[k-y,b-x];
Array3[[t*(b-1)+k]]=TestMod[k,b,y,x];
If[TestMod[k,b,y,x]==0,j=j+1]
]
]

ListPlot[Array3]
External link: http://img.removedfromgame.com/imgs/graph.png (http://img.removedfromgame.com/imgs/graph.png)


The next picture is a strange attractor that belongs to a family of functions known as Lorenz equations. This particular family is characterized by their extreme sensitivity to initial conditions. A change of one in a hundred parts can result in a completely different system.
Spoiler For Lorenz attractor:
(http://img.removedfromgame.com/imgs/Lorenz_fractal.bmp)
External link: http://img.removedfromgame.com/imgs/Lorenz_fractal.bmp (http://img.removedfromgame.com/imgs/Lorenz_fractal.bmp)


Here is an example of such a change. A single constant in the equations was changed to produce this graph from the previous one.

Spoiler For Spoiler:
(http://img.removedfromgame.com/imgs/Lorenz_lines.bmp)
External link: http://img.removedfromgame.com/imgs/Lorenz_lines.bmp (http://img.removedfromgame.com/imgs/Lorenz_lines.bmp)


Another group of functions with interesting graphs are the one dimensional elementary cellular automata. In addition to their interesting computational properties (several of them are Turing-equivalent), some of them are chaotic to the point that they can safely be used for cryptographic grade random number generators. One particularly well known automaton is Rule 110 (following Wolfram's notation). The picture, which started from random initial conditions, clearly shows the propagating structures that form the basis of this rule's universal computation.

Spoiler For Spoiler:
(http://img.removedfromgame.com/imgs/Rule_110.png)
External link: http://img.removedfromgame.com/imgs/Rule_110.png (http://img.removedfromgame.com/imgs/Rule_110.png)

Cellular automata can occupy more than one dimension, though. Here's a model of a two dimensional cellular automaton known as Conway's life rendered over time.
Spoiler For Spoiler:
(http://www.frank-buss.de/automaton/symmetric_rabbits.gif)
External link: http://www.frank-buss.de/automaton/symmetric_rabbits.gif (http://www.frank-buss.de/automaton/symmetric_rabbits.gif)

If anyone has anything else, feel free to link it below.
Title: Re: The Beauty of Mathematics
Post by: p2 on July 21, 2011, 02:36:58 pm
The last pic shows a ship of the "Replicatoren" (german) of Stargate SG1!
Title: Re: The Beauty of Mathematics
Post by: ZippyDee on July 21, 2011, 03:09:14 pm
Wow! These are awesome! Thanks, Qwerty!
Title: Re: The Beauty of Mathematics
Post by: Anima on July 21, 2011, 05:51:57 pm
The second pic is pretty awesome.
Title: Re: The Beauty of Mathematics
Post by: Darl181 on July 21, 2011, 07:15:55 pm
How do you make pics of the fractals like that--is there a generator somewhere or something?
Title: Re: The Beauty of Mathematics
Post by: Scipi on July 21, 2011, 07:22:07 pm
I want a 3D Game of Life Generator now! :P
Title: Re: The Beauty of Mathematics
Post by: DrDnar on July 21, 2011, 07:23:21 pm
Make a plot of the length of all Roman numerals less than some value and you get a bell curve.

EDIT: Code for the lazy:
Code: [Select]
FUNCTION decToRom$ (num AS INTEGER)
DIM rom AS STRING
DIM dec AS INTEGER
DIM i AS INTEGER
DIM j AS INTEGER
DIM x AS INTEGER

dec = num + 1 - 1 ' Bonus points if you can explain why this is here.


IF dec < 1 OR dec > 3999 THEN ERROR 5

i = 1
DO WHILE dec / 10 > 0
    x = dec - INT(dec / 10) * 10 ' Mod is for losers.
    dec = INT(dec / 10)
    IF x >= 1 AND x <= 3 THEN
        FOR j = 1 TO x
            rom = romchar(i) + rom
        NEXT j
    END IF
    IF x = 4 THEN rom = romchar(i) + romchar(i + 1) + rom
    IF x = 5 THEN rom = romchar(i + 1) + rom
    IF x >= 6 AND x <= 8 THEN
        FOR j = 1 TO x - 5
            rom = romchar(i) + rom
        NEXT j
        rom = romchar(i + 1) + rom
    END IF
    IF x = 9 THEN rom = romchar(i) + romchar(i + 2) + rom
    i = i + 2
LOOP
decToRom$ = rom
END FUNCTION

FUNCTION romchar$ (quark AS INTEGER)
romchar$ = MID$("IVXLCDM", quark, 1)
END FUNCTION
Title: Re: The Beauty of Mathematics
Post by: apcalc on July 21, 2011, 07:30:08 pm
Wow!  Math can be amazing at many, many times.  Those images are truly beautiful! :D
Title: Re: The Beauty of Mathematics
Post by: AngelFish on July 21, 2011, 09:03:13 pm
@Darl: I used Chaosope (http://www.chaoscope.org/) to generate the second and third pictures. There are a lot of other attractor/fractal generating packages, but I find that one produces nice images without too much fuss. The first and fourth pictures were generated using Mathematica, which I don't recommend purchasing unless you have some means of obtaining it for free/small cost (generally schools or piracy).

I want a 3D Game of Life Generator now! :P

Here you go (http://www.qotile.net/blog/wp/?p=600). Requires Golly (http://golly.sourceforge.net/), Blender (http://www.blender.org/), and Python.

@DrDnar: I presume that the Dec+1-1 somehow detects/fixes integer overflow? Anyway, while the mathematics behind Gaussians are very elegant and pretty, I made a conscious choice not to include them because they don't generally look terribly impressive.
Title: Re: The Beauty of Mathematics
Post by: DrDnar on July 21, 2011, 10:03:26 pm
Nope. I put it there because QuickBASIC uses pass-by-reference by default.
Title: Re: The Beauty of Mathematics
Post by: Deep Toaster on July 22, 2011, 12:50:28 am
That's (part of) why I love math :)

And there's another beauty outside the graphs. Aren't equations like eπi+1=0 (http://en.wikipedia.org/wiki/Euler%27s_identity) just amazing to think about? Even with all those proofs, many of which aren't even that advanced, I still can't wrap my head around the idea.

The last pic shows a ship of the "Replicatoren" (german) of Stargate SG1!

lol :P

I want a 3D Game of Life Generator now! :P

Plot three dimensions against time O.O
Title: Re: The Beauty of Mathematics
Post by: p2 on July 22, 2011, 01:17:29 pm
This is a Replikator:
(http://stargatecity.st.funpic.de/HTML/Voelker/Replikatoren.jpg)
(http://www.thescifiworld.net/img/wallpapers/stargate/mirko_stoedter/mirko39_1280x1024.jpg)





(http://www.stargate-wiki.de/w/images/thumb/a/a5/Replikatorenschiff_02.png/200px-Replikatorenschiff_02.png)


(http://www.stargate-wiki.de/w/images/thumb/1/16/8x17_Dakara-Superwaffe_zerst%C3%B6rt_Replikatorenkreuzer.jpg/200px-8x17_Dakara-Superwaffe_zerst%C3%B6rt_Replikatorenkreuzer.jpg)
(http://www.stargate-wiki.de/w/images/thumb/0/0b/Replikatorenschiff_01.png/250px-Replikatorenschiff_01.png)


(http://www.stargate-wiki.de/w/images/thumb/d/dc/Replikatorenschiff_03.png/250px-Replikatorenschiff_03.png)
(http://www.stargate-wiki.de/w/images/thumb/7/73/Replikatorenschiff_04.png/200px-Replikatorenschiff_04.png)

I only know these three types of Replikatoren-ships, but it looks like a ship of them, too!
Title: Re: The Beauty of Mathematics
Post by: Scipi on July 22, 2011, 04:23:12 pm
Replicators were the awesomest enemies in the series. :P Even the Ori would have trouble with them.

Here's something else the Game of Life can do:

Spoiler For Spoiler:
(http://dl.dropbox.com/u/10573921/TheGame.png)

It can make you lose :P
Title: Re: The Beauty of Mathematics
Post by: calcdude84se on July 22, 2011, 05:18:04 pm
Aw, that's cheating. You actually have to make a pattern that displays that, like the Golly ticker pattern. ;D
Title: Re: The Beauty of Mathematics
Post by: Scipi on July 22, 2011, 05:19:48 pm
I don't have to, I have a program that does it for me :P

http://tlrobinson.net/blog/2009/02/07/game-of-life-generator/ (http://tlrobinson.net/blog/2009/02/07/game-of-life-generator/)
Title: Re: The Beauty of Mathematics
Post by: calcdude84se on July 22, 2011, 05:22:33 pm
...
Fine then :P
While we're talking about the GoL, I find the Gemini (http://conwaylife.com/wiki/Gemini) pattern to be interesting.
Title: Re: The Beauty of Mathematics
Post by: AngelFish on July 22, 2011, 06:37:53 pm
Here's a cool demonstration of using cellular automata to make music: Otomata (http://www.earslap.com/projectslab/otomata)
Title: Re: The Beauty of Mathematics
Post by: Scipi on July 22, 2011, 06:59:01 pm
lol if I make a glider in that program it reforms

http://earslap.com/projectslab/otomata/?q=10_0_165_111672313762872571120010773210 (http://earslap.com/projectslab/otomata/?q=10_0_165_111672313762872571120010773210)
Title: Re: The Beauty of Mathematics
Post by: Munchor on July 24, 2011, 09:35:30 am
Very good post Qwerty.55, it truly shows us how Maths can help us with art and make beautiful things!