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:
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.
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.
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.
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).
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.
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)