# Second Anniversary

2017-03-28, post № 165

art, #2 years, #celebration, #collage, #j, #J-Blog, #jblog, #two years

J-Blog celebrates its second anniversary!
Exactly two years ago, on the twenty-eighth of March 2015, the very first post on this blog appeared, appropriately named “Hello World”. Since then, including this one, 𝟣𝟨𝟦 other posts have been posted. Here a few of the image highlights from both years, with their corresponding post.

                     -
?][)0Zqpkdc
QmphM&88888%av
Z&88%%%8M*%B8X
JW&Mbw\1] ZB@b
?-        #BB%c
m@@@kc
?o@BBC
]&@@*v
L%@%Y
o@BZ
LB@a
]%BM?
*B&v
k%&v
mBWv
wBWv
ZB*
w@O
W8z
[BO
ao]
Ckc                k&z
b@#Z?            [a8L
X%$@*Q[? ?[q%&} {&%%8&kwm00mdM%%w? ?ZW8%%%%%%B8&q] -}\wpkpft[  # Bifurcation Diagram 2017-03-25, post № 164 mathematics, PIL, programming, Python, #alpha, #chaos, #chaos theory, #delta, #Feigenbaum, #fractal, #iterations, #Mandelbrot set, #modelling, #population Generating the famous fractal, which can be used to model populations with various cycles, generate pseudo-random numbers and determine one of nature’s fundamental constants, the Feigenbaum constant 𝛿. The fractal nature comes from iteratively applying a simple function, $x\mapsto\lambda\cdot x\cdot (1-x)$ with $0\leq\lambda\leq 4$, and looking at its poles. The resulting image looks mundane at first, when looking at $0\leq\lambda\leq 3$, though the last quarter section is where the interesting things are happening (hence the image below only shows the diagram for $2\leq\lambda\leq 4$). From 𝜆 = 𝟥 on, the diagram bifurcates, always doubling its number of poles, until it enters the beautiful realm of chaos and fractals. For more on bifurcation, fractals and 𝛿, I refer to this Wikipedia entry and WolframMathworld. Source code: bifurcation-diagram.py # Pi Day MMXVII 2017-03-14, post № 163 mathematics, programming, Python, #approximation, #dimensions, #four, #four dimensions, #generator, #higher dimensions, #hyperspheres Every year on March the 14th, for one day the world gets irrationally excited about the famous constant 𝜋. As is tradition, you try to calculate 𝜋 in unusual ways, demonstrating the constant’s ubiquity as it crops up in the most unexpected circumstances.  lnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nJw v$$n$$$$z u$$mnn: Y$$i .@$$$$,$$n )$$* W$$$$m -n[$$$$. ]$$ h$$w$$Y [ X$$"$$$$n '$${ .$         8$$*$$$$} :$$+
#u         $$% t$$         ;$$ u$$!         $$W Y$$M         .$$, f$$$$. Z$$$$Z nn w$$$$|$$(         v$z n$W           $$1 'X8 Y$$            *$$8nnnn$$$p $@.             W$n _$${ x$$$0>
-n{.                     !|nt_.                

A fairly well-known way to approximate 𝜋 is to randomly choose points in a square (often thought of as throwing darts at a square piece of cardboard), determine their distance to a circle’s center and do a division, as I did in my 𝜋 Generator post.

However, 𝜋 does not only appear in the formula for a circle’s area, $A=\pi\,r^2$, yet [1] also in the formula for a sphere’s volume, $V=\frac{4}{3}\,\pi\,r^3$, and for all the infinite hyperspheres above dimension three (view this Wikipedia article for more about volumes of higher-dimensional spheres).

In particular, the formula for the hypervolume of a hypersphere in four dimensions is defined as being $V=\frac{\pi^2}{2} \cdot r^4$. Using this formula, my Python script randomly chooses four-dimensional points (each in the interval $\left[0,1\right)$), calculates their distance to the point $\left(0.5,0.5,0.5,0.5\right)$ and determines if they are in the hypersphere around that point with radius 𝟢.𝟧.
By dividing the number of random points which lie in the hypersphere by the number of iterations used ($10^6$ in the example below), the script approximates the hypersphere’s hypervolume. By then rearranging the equation $V=\frac{\pi^2}{2}\cdot r^4$ with 𝑟 = 𝟢.𝟧 to $\pi=\sqrt{V\cdot 32}$, the desired constant can be approximated.

\$ python pi.py
3.14196371717`
Source code: pi-day-mmxvii.py
Jonathan Frech's blog; built 2021/04/16 21:21:49 CEST