Articles

Game of life – particles

My background is in N-body simulations, but I find cellular automata fascinating. These two classes of simulations have a lot in common, but fundamental differences. The names give away what the main difference is: cellular automata consist of cells (arranged in some regular grid), while N-body simulations consist of bodies (particles). Some years ago a particle-based “Game of Life” became popular on the Internet. While it’s a cool project, it is in fact just an N-body simulation, with individual particles exerting forces on each other depending on distance and the particles’ classes. It is not faithful to Conway’s original idea for this game, that state (or class) changes depending on the neighbourhood.

Read more

Acceleration in Special Relativity

This applet calculates a round trip to a star at a distance D from the origin (specified in light years). The fraction of time spent in accelerated motion, explained in this article, is f. Γ is the maximum Lorentz factor reached. The signals are sent at constant intervals of proper time (i.e. in the traveller’s non-inertial frame). The left panel is a space-time diagram, showing the time vs. displacement in the origin’s frame. The thick blue line is the spaceships’ path, and the thin red lines are the signals (travelling at the speed of light back to the origin). The right panel shows the time a signal is received (in the origin’s frame) as a function of the proper time when it was emitted.

Read more

Restaurant reviews revisited

Over a year ago I analyzed restaurant reviews in Budapest and came up with a complimentary way to rank businesses. This was based on the 4- and 2-star reviews rather than the average score. I followed up by repeating this analysis for Toronto. Below are the results (particularly comparing the two cities) and some new thoughts.

Read more

Three-body encounter rate in one dimension

Walking long and mildly busy streets in Budapest, I noticed that 3-body encounters were surprisingly common. 2-body encounters are when two people walking in opposite directions meet, or they walk in the same direction and one passes the other. These seemed rare enough (only a few per minute on my daily route), so I got curious how come a relatively large fraction of them involved a third person walking independently. The full mathematical description of the problem can be found here and a simple applet to calculate the encounter rate using a toy model can be found here.

Read more

Probability of a multivariate function

I frequently encounter the problem of having to find the probability density function (pdf) of some quantity which is a function of several independent random variables with known distributions. For some cases such as addition of two variables, there exists a relatively simple formula (the new pdf is just the convolution of the two) but there is no general magic formula.

Read more

Restaurant review analysis

Choosing a restaurant can be a difficult task, and is often based on a single number, the score of a restaurant in an online listing. This score is usually a weighted arithmetic mean of customer’s one- to five-star reviews, such is the case with TripAdvisor. But how reliable is this number? Let’s find out. In the figure I plotted the “standard” average score versus some alternative (complementary) definition that will be discussed in this article.

Read more

Miner’s spiral

If you dig straight down, you reach the centre of the Earth 6400 km below the surface, but what happens if you dig at a shallow but constant angle? Intuitively the result would be a spiral, and it’s easy to show. We just need to assume some constant digging “speed” and a constant ratio of the radial and tangential velocity components given by the angle’s tangent.

Read more

Flight clock

Long haul flights can be confusing. You start at some time zone, and hours later find yourself in another, but for the duration of the flight you exist in time zone limbo. Airlines serve breakfast, lunch, or dinner at somewhat arbitrary times, and the Sun’s position in the sky is not always helpful (flights between East Asia and North America pass through the polar circle, where the Sun can be up at midnight or down at midday). Indeed, local time on the plane is effectively squeezed or stretched compared to real time, in a non-linear way. This has nothing to do, of course, with relativistic time dilation, it is just a result of time zone offset at different locations on the surface of the Earth. Local time in this article is the approximate time on the ground below the aircraft, so a function of both universal time and location (mostly just the longitude).

Read more

Error flower

This beautiful image has no deep meaning, it’s just a visualization of numerical error. I used my ETICS code to calculate the gravitational force in a triaxial ellipsoid in single and double precision, with the difference being the numerical error. The error distribution is bimodal, and the blue and red dots are points around the two peaks.

Read more

Block time step storage scheme

Particle-based simulations (such as N-body simulations) usually output data as “snapshots”, meaning a list of the instantaneous values of some properties of all particles in the simulation (e.g. positions and velocities in the N-body case). That often means that the snapshot output frequency is a compromise between the desire to accurately record the temporal behaviour and storage capacity (and I/O overhead). The BTS storage scheme that we published in Cai et al. (2015) is an adaptive storage scheme for simulation data that addresses this issue. It works by minimizing the data redundancy, by assigning individual output frequencies to the data as required. In other words, it provides a fine-grained control of the resolution of scientifically interesting data while suppressing the uninteresting ones.

Read more

3D model of a rib cage

This is a visualization I made of a chest cavity using computed tomography (CT) scan data, which I got from a radiology lab on a CD-ROM (as if it were 2002). The data were in a weird and pretty archaic data format called DICOM that is apparently a standard for medical imaging. I used a Python package called pydicom to read it into a 3D numpy array representing the density (or opacity to X-rays or something like that). The array’s shape was 512x512x465 and the values were integers from 0 to 4095. The scan resolution was about 30.2 dpi (which for a 2D document would be extremely poor). Strangely along the z- (spinal-) axis the resolution is slightly different, 33.9 dpi. I used MayaVi to plot an isosurface to my liking. I had to play a lot with the contour value: if too low, too many soft tissues show up, if too high, the costal cartilages doesn’t show (that’s some piece of cartilage that connects each rib to the sternum). Unfortunately even with this careful choice, the 3D model had quite a lot of soft tissues which would have been very difficult to exclude in the Python script. So I exported the model and used Blender to manually remove the soft tissues. This was quite a hassle, but when it’s done it’s relatively easy to set up this rotation animation in Blender and render in high quality.

Read more

Mars

I gave a KIAA pizza talk about Mars in January 2015. This was an overview of topics related to Mars that were being discussed at the time. I curated much of the information from various Wikipedia articles and NASA press releases. The focus is the Martian atmosphere, transient detection of methane, and the Martian meteorite ALH84001.

Read more

IAU Symposium #312

I was one of the local organizers of the 312th Symposium of the International Astronomical Union (IAU) Star Clusters and Black Holes in Galaxies across Cosmic Time that took place at the National Science Library of Chinese Academy of Sciences in Beijing in summer 2014. While I didn’t choose this mouthful of a name for the conference, I designed the lovely poster and was chief editor of the conference proceedings (hardcover by Cambridge University Press, ISBN-13: 9781107078727).

The poster design was done in Inkscape mostly. I ended up liking the result but it was quite a hassle and I had to try to satisfy too many people in the committee, I will certainly think twice before volunteering for such a task again. The proceedings editing was done in Latex with a lot of Python scripting to administer the many proceedings papers and forming them into a single work.

Read more

Computational fluid dynamics visualization

I participated in the 4th Visualize This! challenge, a Canada-wide competition that “aims to celebrate the innovative ways visualization can help researchers explore datasets and answer important scientific questions”. It was hosted by Compute Canada regional partners and the Compute Canada Visualization Team (which I joined the following year). My submission, that won second place, explores the flow around an airfoil from a particularly large computational fluid dynamics simulation (performed by Joshua Brinkerhoff’s team at UBC Okanagan), in particular the separation of the laminar boundary layer from the airfoil and its transition to turbulence. My visualization was a demonstration of the VTK-m library (Visualization Toolkit–many cores), an open source C++ library for scientific visualization maintained by Kitware. I chose to experiment with this library because it was specifically designed for the GPU-accelerated HPC environment. This experiment was only partially successful, it turned out the library was not mature enough at the time to achieve my goals.

Read more

Stream detection with machine learning

The Milky Way galaxy is surrounded by a large number (dozens known) of dwarf galaxies. Due to dynamical friction, such galaxies occasionally fall into the Milky Way; this causes them to be transformed from a nearly spherical shape to an elongated shape, eventually developing very long tails of stars in a phenomenon called tidal disruption. The tails of the disrupted dwarf galaxies contain stars streaming from that galaxy’s core out toward the Milky Way’s halo, and they can be observed as lines running across the night sky. These are called tidal streams. Their observation, however, is not a trivial matter. Since dwarf galaxies contain only very few stars to begin with (compared to the Milky Way), the number of stars in tidal streams is very small compared to the background. Thus, tidal streams are too faint certainly to observe with the naked eye, but telescopic data often requires careful analysis to reveal their presence. A census of tidal streams is important for the understanding of the history of the formation of the Milky Way galaxy, and by extension the assembly of galaxies in general.

Read more

The Laohu supercomputer

This is a picture of the Laohu (老虎) (Tiger) cluster in Beijing, which I helped maintain. When it was launched in 2009, it had 85 nodes equipped with two Intel Xeon E5520 CPUs and two Nvidia Tesla C1060 GPU accelerators per node. In its last configuration before it was shut down in Feb. 2020, only 32 nodes remained but they have been upgraded with two Nvidia Tesla K20 GPUs per node. Laohu was “my” first supercomputer, and on it I learned high performance computing (HPC) from both the user and admin perspective, and how it is an essential tool in astrophysics and in science and general.

Read more

2-body and resonant relaxation

Relaxation is the return of a perturbed system to equilibrium. This is very general: this return to equilibrium may occur in different ways and due to multiple processes, affecting different physical quantities. Therefore, the concept of relaxation time has had multiple quantitative definitions in the literature. In star clusters we have two processes driving relaxation: 2-body (collisional; nonresonant) and resonant relaxation. 2-body relaxation (which is what people traditionally mean when talking about relaxation in stellar systems) is so-named in analogy to molecules colliding in a gas.

Read more

SCF and hybrid N-body

In stellar dynamics, direct N-body codes are generally used due to their high accuracy in orbital integration. These codes consider all pairwise interactions and are thus very slow. On the other hand, N-body methods used in cosmology (such as Barnes–Hut tree) are much faster per particle, but they are usually unsuitable for star clusters. The advantage of using a direct code is diminished when parts of the stellar system (or all of it) have very long relaxation times. This is the case in galactic nuclei, dwarf galaxies, and other astrophysical systems. The self-consistent field (SCF) method is a way to estimate the gravitational field through a series of smooth potential terms. Based on it, I wrote a collisionless N-body code called ETICS. This code is parallel (using MPI) and GPU-accelerated.

Read more

Gravitational waves sources

I got involved in research in the field of gravitational waves (GW) with Bence Kocsis shortly after their first observation by LIGO. In Meiron et al. (2017) we examined whether future GW detections may identify triple companions of merging binaries. Such a triple companion causes variations in the GW signal mostly due to the Doppler effect. The research was carried out by producing mock signals of merging compact objects in isolation, and then perturbing them by varying the light travel time in accordance with the motion of the binary around the centre of mass of the triple system. The signal-to-noise ratio in the residual between the perturbed and unperturbed signals was computed (using the advanced LIGO noise curve) to determine whether the perturber would be detectable. We found that the prospects for detecting a triple companion are the highest for low-mass compact object binaries. For example, for merging neutron star binaries, LIGO may detect a white dwarf or M-dwarf perturber if it is within a distance of 0.4 R from the binary and the system is within a distance of 100 Mpc.

Read more

The star–disk project

In this long term “Silk Road” collaboration (Heidelberg-Kyiv-Almaty-Beijing), we studied several aspects of interactions of stars with gaseous disks in active galactic nuclei. We performed high resolution N-body simulations with an added source of friction (drag) representing the disk. We studied how the disk affects the tidal disruption event (TDE) rate of stars, as well as the formation of a stellar disk from captured stars. We found that the TDE rate may increase by a factor of ∼10 (compared to a galactic nucleus without a gaseous disk). The total mass accreted from disrupted stars though is not a significant contribution to the black hole’s growth.

Read more

Stability around a supermassive black hole binary

My Ph. D. thesis (digital copy available on request) focused on stars around a supermassive black hole binary. This animation shows the stability volume in velocity space for a star in the equatorial plane of such a supermassive black hole binary, or a planetoid in the equatorial plane of a binary star. Velocities inside the volume produce stable orbits while velocities outside it produce unstable ones. In the presence of a single gravitational object at the centre of the system instead of a binary, the stability volume looks like a sphere: stable orbits are ones with velocity magnitudes smaller than the local escape velocity. If the central object has a finite size though, a loss cone is carved, where orbits with low angular momentum produce radial orbits, which are said to be unstable because they lead to tidal disruption (or being swallowed) by the central object. So in this case, the loss cone would appear as a cylinder in this velocity presentation. When the central object is a binary, the loss cone becomes much larger, because in addition to tidal disruption, the orbit can be dynamically unstable: in other words one of the black holes can kick the star out of the system. The fact that the binary supermassive black hole is rotating in a particular orientation breaks the symmetry: stellar orbits which are retrograde with respect to the central binary are more stable than prograde ones. This leads to the enlarged cylinder to also be distorted.

Read more