Some GLSL imagery

Hello. It’s been a long time. Let’s ignore that.

In a recent urge to put more FOSS apps on my Android phone, I installed a marvelous application called Shader Editor.  The app is basically just a GLSL editor that compiles the code live. You can use then use these shader files to make them animated wallpapers for your phone.

There exists a web-app for this too, for those who don’t like writing code on a phone (it’s a nightmare, really!). It’s called GLSLSandbox. You can hence write the code online and send it to your phone for Shader Editor to make a wallpaper out of it.

So for example writing the following code in the app:

#extension GL_OES_standard_derivatives : enable
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif


#define PI 3.14159268
uniform vec2 resolution;
uniform float time;

vec2 invert(vec2 x)
{
float d=x.x*x.x +x.y*x.y;
return vec2( x.x/d,-x.y/d);
}

vec2 cube(vec2 x)
{ return vec2(x.x*x.x*x.x- 3.0*x.x*x.y*x.y,
-x.y*x.y*x.y +3.0*x.x*x.x*x.y) ;
}


vec3 design(float scal)
{
if(abs(scal) <0.54)
return vec3(0.350+0.1*sin(scal),0.230,0.25);
else
return vec3(0.3,0.1+0.05*sin(2.0*scal) ,0.2*scal);
}
void main(void) {
float mx = max(resolution.x, resolution.y);
vec2 uv = gl_FragCoord.xy / mx;
vec2 center = resolution / mx * 0.5;
float t = time * 0.40;

float scalar=sin(40.0*uv.x) *
sin(t+20.0*uv.x-1.732*20.0*uv.y) *
sin(t+20.0*uv.x+1.732*20.0*uv.y);

scalar=sin(8.0*scalar) ;
gl_FragColor = vec4(design(scalar), 1.0);
}

Gives the following result (recorded from GLSLSandbox):

hexer.gif

Soon I found myself doodling with this app, through which I created some trippy visuals that I would like to share. I’ll add them soon in a different blogpost.

Advertisements

Some pictures in the hyperbolic 3-space

The following are some pictures created as part of my semester project in the 2017-18 Fall semester at EPFL. The project was under the guidance of Prof. Maryna Viazoska. The project involved building the prerequisites and understanding this paper of Don Zagier.  Below, I will give some very brief details of the pictures and the project. The full write-up that I wrote for this project can be found here.

The hyperbolic 3-space is a Riemannian manifold. As a set, the Hyperbolic 3-space {\mathbb{H}^3} can be visualized as {\mathbb{R}^2 \times \mathbb{R}_{+}}, given the metric tensor of the Riemannian manifold given by

\displaystyle ds^2 = (dx^2+dy^2+dt^2)/t^2. \ \ \ \ \ (1)

The following picture is of the set given by

\displaystyle \{(x,y,t) \in \mathbb{R}^2\times \mathbb{R}_+\ | \ x^2+y^2+t^2 \ge 1, x\le \frac{1}{2} , y \le \frac{1}{2}, x+y \ge 0 \}. \ \ \ \ \ (2)

rsz_fundregion

This set is the fundamental region of the action of the group {PSL(2,\mathbb{Z}[i])} as a discrete subgroup of {PSL(2,\mathbb{C})}, the group of isometries on the Hyperbolic 3-space, visualized as the upper half-space of {\mathbb{R}^3} in the above picture.

Measuring volumes in Hyperbolic 3-space (volume measured according to the metric tensor) is done by utilizing the concept of ideal tetrahedra. A tetrahedron is said to be an ideal tetrahedron if it has at least one ideal vertex in the upper-half space model, and one vertex at {\infty}, and the projection of the tetrahedron from {\infty} is a right-angled triangle on the {xy} plane. And ideal vertex in the upper-half space model is a vertex which is of the form of two vertical planes (spheres containing infinity), whose axis of intersection is intersecting with the unit hemispherical geodesic perpendicularly (and therefore, at the apex point of the hemisphere.

The volume of such a tetrahedron is given by the following formula in the upcoming proposition, and an illustrative picture right after.

Proposition 1 Suppose {T_{\alpha, \gamma}} is the ideal tetrahedra that has a dihedral angle (the angle between the two vertical planes) as {\gamma} and has an acute angle (that is, the angle between the geodesic plane opposite to {\gamma} and the unit geodesic hemisphere) given by {\alpha}. Then the following is true.

\displaystyle \text{Vol}(T_{\alpha,\gamma}) = \frac{1}{4}(\mathcal{L}(\alpha+\gamma)+\mathcal{L}(\alpha-\gamma)+2\mathcal{L}(\frac{\pi}{2}-\alpha)). \ \ \ \ \ (3)

Here {\mathcal{L}} is the Lobachevski function, described by the equation

\displaystyle \mathcal{L}(\theta)= - \int_{0}^{\theta} \log|2\sin(u)| du. \ \ \ \ \ (4)

The proof of this proposition can be found in the write-up. Here is the picture of a sample ideal tetrahedron.

rsz_idealt

For more complicated tetrahedrons, one has to decompose it by writing it as a sum and difference of ideal tetrahedrons. Any tetrahedron can be seen as the difference of two tetrahedrons with one vertex at infinity (after applying suitable isometries), both of which can be decomposed into ideal tetrahedra as shown below.

rsz_changedperspective

I will very crudely mention the purpose of seeing these things in a write-up about the special values of Dedekind-zeta functions.

The project that I had done entails Zagier’s generalized expression for a particular special value of the Dedekind zeta function. The generalized expression was obtained by noting the appearance of the Dedekind zeta function in the expressions of the volumes of arithmetic hyperbolic 3-manifolds, and after some careful manipulation of these volumes on arrives at the following theorem.

Theorem 2 (Zagier, 1986) Let {K} be an arbitrary number field. Suppose {A(x)} is a real valued function given by

\displaystyle A(x)=\int_0^x \frac{1}{1+t^2}\log{\left( \frac{4}{1+t^2} \right)}dt. \ \ \ \ \ (5)

Then we have that the value of {\zeta_K(2)} is given by an expression as below.

\displaystyle \zeta_K(2)=\frac{\pi^{2r+2s}}{\sqrt{D}}\sum_\nu c_\nu A(x_{\nu,1})A(x_{\nu,2})\dots A(x_{\nu,n}). \ \ \ \ \ (6)

where the sum above is finite, {D} is the discriminant of the number field, {r} is the number of real places and {s} is the number of complex places associated to the number field {K}. Moreover, the {c_\nu} are rational and {x_{\mu,j}} are real algebraic numbers.

Here is some motivation for studying this theorem. In 1734, Euler resolved the famous Basel problem which asked the following question:

What does the sum of the following infinite series converge to?

\displaystyle \frac{1}{1^2}+ \frac{1}{2^2}+ \frac{1}{3^2}+ \frac{1}{4^2} \dots \ \ \ \ \ (7)

The answer was found to be {\frac{\pi^2}{6}} by Euler. This has the following consequence in modern terminology. We define the Riemann-zeta function for {1<s \in \mathbb{R}} to be the function

\displaystyle \zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s}. \ \ \ \ \ (8)

So rephrasing the Basel’s problem simply amounts to saying that {\zeta(2)=\frac{\pi^2}{6}}. We will consider the generalization of the identity of Equation (8) in the case of the Dedekind zeta function.

The Dedekind zeta {\zeta_K} associated to the number field {K} is defined as the following for a number field {K} and for {1<s \in \mathbb{R}}.

\displaystyle \zeta_{K}(s)=\sum_{ \mathcal{I} \text{ is a non-zero integer ideal of } K} N(\mathcal{I})^{-s}. \ \ \ \ \ (9)

The Dedekind zeta function is an important function that has important connections in number theory. Putting {s=2} and {K} as the simplest number field {\mathbb{Q}}, the above equation turns into Equation (7). Zagier’s theorem is a very nice generalization of the above identity of Euler’s.

In the report, I have spent a considerable length justifying the appearance of the Dedekind zeta function in the volume formula of hyperbolic 3-manifolds.

I believe that this project was by far the most intense reading project I had ever taken.