##### January 8, 2023

This document explains a proof-of-concept database that is optimized for storing OHLC data. It is far from finished.
Time series of low resolution charts can quickly consume a large amount of storage. The goal of BarDB is to store market data structured as OHLCV candles as efficiently as possible. This document aims to explain an implementation of a database that is optimized to solve this specific problem.
To keep in mind if we should, instead of being to busy trying to figure out if we could, it is important to compare this solution against other implementations with a relational database and a schemaless database.
...

##### January 4, 2023

Clamp
#
The clamp function ensures that a value stays within a certain range. This range is usually between $[0, 1]$, but it can be any range. The function is defined as
$$ \text{ clamp(x) } = \max ( \min (x, 1), 0 ) $$
If the value of $x$ is greater than $1$, the min function ensures that the result is $1$. Likewise, if $x$ is less than $0$, the max function ensures that the result is $0$.
...

##### December 11, 2022

The idea of this shader is to visualize a star and the gravity field that is generated by it. A few key aspects of the shader:
It uses raymarching to render the scene by taking four samples per pixel. The coordinates of the point on the sphere are mapped to UV-coordinates which are used for the texture. The closest distance to the sphere is also being tracked by the raymarcher, which is used to add the glow.
...

##### December 7, 2022

A lot of problems can be described as a constraint satisfaction problem (CSP). This post is intended as a short primer to help you get started.
What is a constraint satisfaction problem?
#
A constraint satisfaction problem consists of three components. The first component is a variable to which a value can be assigned. The second component is the domain. Each variable has a list of possible values that can be assigned to the variable.
...

##### November 19, 2022

In this post we will be looking at the motion of projectiles. Starting from first principles by deriving the equations governing projectile motion. In a later post we will be studying how the different quantities are related.
Deriving the equations
#
A projectile is an object which is moving over time because of its velocity and acceleration. As we know from physics, components that are perpendicular behave independently. In our 2D case this means that the horizontal and vertical components of motion are independent of each other.
...

##### November 10, 2022

One of the first things you will stumble across when writing a raytracer is to find out where a ray and a sphere intersect. In this post we will derive a method that finds this point from first principles.
Vector-form definition of a sphere
#
A sphere is mathematically defined, in vector-form, as
$$ ||\ \mathbf{x} - \mathbf{c}\ ||^2 = r^2, $$
where $\mathbf{x}$ is the point on the sphere, $\mathbf{c}$ is the center of the sphere, and $r^2$ is the radius of the sphere.
...

##### November 6, 2022

This is one of those thing that absolutely blew my mind when I found about it. The first the I came across this is in a video about the logistics map by Veritasium.
I suggest to check out the video if you want to know more about it.
The scene below renders the Mandelbrot set and uses all the real values of $z$ that are in the set as the y-axis.
...

##### November 6, 2022

Another interesting set of fractals is produced by looking at the Julia set of the iterated function
$$ z_{n+1} = \sin (z_n) \cdot c. $$
Instead of looking at the magnitude of the complex number to determine if the orbit escapes to infinity, only the imaginary part of $z$ is used in this case. If the imaginary part of $z$ is greater than 50, then it is decided that the orbit escapes to infinity.
...

##### October 23, 2022

This write-up will explain how an image of the Mandelbrot set can be created with Rust. The image that the program generates is displayed below. It uses a smooth iteration counter that is used to get a smooth coloring. This is one of the first programs that I have written in Rust, and I have kept it pretty simple, meaning that it does not feature multi-threaded support.
Importing the image crate
#
To generate images in Rust we can use the image crate.
...

##### October 16, 2022

Suppose that we have the sun-earth system. The potential energy of a satellite (any point $(x, y)$ in the system) is determined by the following equation:
$$ u = -\frac{1-\mu}{\sqrt{(x + \mu)^2 + y^2}} - \frac{\mu}{\sqrt{[x - (1 - \mu)]^2 + y^2}} - \frac{1}{2}(x^2 + y^2), $$
where $\mu$ is the distance from the center of rotation (the barycenter).
If we use the equation to create a contour plot, we get a pretty cool visualization of the potential energy in the sun-earth system.
...