Making Art with Mathematical Equations, Inequalities and Functions (Mappings, Transformations)
Sunday, September 30, 2012
Gnuplot example: Math Invaders - Remember Space Invaders and Galaxian?
This is a parameter animation (plotted upside down) for the modified Thomae function:
gnuplot script:
d = 0.001
m = 250
f(n,k,x) = k > m ? 3.2 : ( abs(k*x - int(k*x)) < d ? \
3.2-(1+0.1*n*n)/(k*k-abs(k*x)) : f(n,k+1,x) )
set xrange [-1.6:1.6]
set yrange [0:3.2]
set size ratio -1
set samples 10000
unset key
unset xtics
unset ytics
unset border
set bmargin 0
set lmargin 0
set rmargin 0
set tmargin 0
set term gif size 400, 400 animate background rgb "black"
set output "C:\math_invaders.gif"
set pointsize 0.5
do for [i=0:150]{
plot f(i,1,sin(x)) with points pt 11 lc rgb "white"
}
set output
Note that we set less samples(10000). By incresing samples to 200000,
we can obtain a more accurate (but less fun) picture.
( Mathematical software used: gnuplot )
Related posts:
My Blog CoolMath, contains some of the awesome problems in mathematics. These are not unsolved (but are my approaches to some unsolved problems), and will be loads of fun for the geeks. Most problems are at least moderately difficult, and I have solutions to most of them, if you need them. Please visit http://cool--math.blogspot.in/
ReplyDelete