How I make posters for scientific events

A scientific poster must attract attention and communicate the event in seconds, despite portraits, schedules, logos, and QR codes. For PRAPI and FNIP, I compose in Inkscape and automate repetitive elements with scripts. Start with the reading order I decide what people should read first: Name of the event. Date and place. Main speakers or programme. Registration link and QR code. Organizers and sponsors. Text size follows this order: the title works at a distance; details reward a closer look. ...

Poisson-Boltzmann equation

How are the ions in a solution distributed in a region of space subjected to an external electric field? The Poisson-Boltzmann equation gives us a way to answer this question. The equation is basically the Poisson equation from electrostatics $$ \nabla^2 \phi = -\frac{\rho}{\varepsilon} , , $$ where $\varepsilon$ is the dielectric constant of the solvent, but with a suitable choice of the charge density, in a self-consistent way. The charge density is given by the requirement that the solution is thermalized, and the ions distribute in the potential in a way described by the Boltzmann distribution. Assuming that the electrostatic potential is the dominant part of the energy, we have $$ n_i = a_i\exp[-\beta z_i\phi] , . $$ where $\beta = 1/k_BT$ is the inverse temperature, $z_i$ is the charge of the charge of the $i$-species present, and $a_i$ are a proportionality constant, such that $$ \sum_i \int dV \ n_i = N , , $$ the total number of ions. Because of charge neutrality, $$ \sum_i a_i z_i = 0 , . $$ We take the charge density to be $$ \rho = \sum_i z_i n_i , , $$ and therefore the Poisson-Boltzmann equation reads $$ \nabla^2 \phi = \frac{1}{\varepsilon} \sum_i z_i a_i \exp[-\beta z_i \phi] , . $$ Aha! A nice nonlinear equation! How to solve it? We can use perturbation methods. ...

Conformal mapping and Helmholtz equation

Inspired by [10.1126/science.1126493]. Conformal transformation and Helmholtz equation Consider the Helmholtz equation describing a scalar phasor field $\psi$ in a 2D space filled by a isotropic medium of index $n(\mathbf{r})$. $$ (\nabla^2 + n^2k_0^2)\psi = 0. $$ the phasor field is corresponding to a given light polarization. We can introduce the complex variable $z=x+iy$, and we have the relations $$ \partial_x = \partial_z+\partial_{\bar{z}}, $$ $$ \partial_y = i\left(\partial_z-\partial_{\bar{z}}\right). $$ By substitution, $\nabla^2 = 4\partial_z\partial_{\bar{z}}$. Consider now an analytical function $w(z)$. We have $$ \partial_z\partial_{\bar{z}} = \left|\partial_z w\right|^2 \partial_w\partial_{\bar{w}}. $$ We can map the Helmholtz equation into $$ (4\partial_w\partial_{\bar{w}} + n’^2k_0^2)\psi = 0 $$ where the new index is $n’ = n |\partial_z w|$. Then, we can map again the Helmholtz equation into new variables $u, v$, having $w=u+iv$, obtaining $$ (\partial_u^2+\partial_v^2 + n’^2k_0^2)\psi = 0 $$ therefore mapping the previous electromagnetic problem into a new problem with a transformed index. ...

Longitudinal and transverse relativistic dynamics

A very simple calculation in relativistic dynamics show an impressive aspect that differentiates the momentum change due to a force in the direction of movement of the body and the transverse ones. By using the definition of relativistic momentum $\mathbf{p}=\gamma m \mathbf{v}$, we can write $$ \frac{d\mathbf{p}}{dt} = \frac{d\gamma}{dt} m \mathbf{v} + \gamma m \frac{d\mathbf{v}}{dt}, $$ by defining the longitudinal and transverse acceleration, with respect to the vector $\mathbf{v}$ $$ \frac{d\mathbf{v}}{dt} = \mathbf{a}_L +\mathbf{a}_T, $$ it is simple to show that the first term in the first equation is only longitudinal $$ \frac{d\gamma}{dt} m \mathbf{v} = \frac{v^2}{c^2} \gamma^3 m \mathbf{a}_L , $$ and the second term is composed of longitudinal and transverse parts $$ \gamma m \frac{d\mathbf{v}}{dt}=\gamma m (\mathbf{a}_L+\mathbf{a}_T). $$ Summing the contributions, we can separate the Newton equation with respect to transverse and longitudinal forces, obtaining $$ \frac{d\mathbf{p}}{dt}=\gamma^3m \mathbf{a}_L+\gamma m \mathbf{a}_T. $$

Simple (but nontrivial) vectorization in Numpy

f(a, b, c, d) Let’s say we want to explore the behavior of f in some range of parameters. How can we vectorize the function and iterate over all possible combinations? Is building a Cartesian product the best way? We expect this to be very inefficient, like $O(n^2)$ with respect to $O(n)$ inefficient in memory, at least. Let’s say the parameters have a definite number of samples (len(x) or np.shape(x) in pyhon, with x a parameter vector). We change the axis of the numpy vectors, making them multi-dimensional vectors (or, respecting the notion of dimension in algebra, multi-axial): ...

Simple Multiprocessing in Julia

In this short post, we analyze the computation of a two-variable function on a grid, that is a common task for exploring physical properties of systems through phase diagrams, and similar using Distributed, Printf @info @sprintf("Number of workers: %d", nprocs()) @everywhere function loop_compute(x) for i in 1:100000000 x += sin(x) end return x end t0 = @elapsed loop_compute(1.0) @info @sprintf("Single eval time [s]: %4.3e", t0) mat = rand(10, 10) t_pmap = @elapsed pmap(loop_compute, mat) @info @sprintf("pmap eval time [s] : %4.3e", t_pmap) t_sing = @elapsed loop_compute.(mat) @info @sprintf("serial eval time [s] : %4.3e", t_sing) @info @sprintf("Speeup ratio: %4444", t_sing/t_pmap) Try to run this simple script using ...

Linux Admin Tools

This post is designed to be updated as soon as new tricks come handy. Useful commands Instruction Command Change user su - <username> Change owner chown user:group -R folder Check owner & permissions stat filename List all users with UID cut -d: -f1,3 /etc/passwd List all groups with GID getent group Linux ownership system rwx Owner and permissions: typing la we get informations about the pemissions about a file or a folder ...

A clean installation of SLURM scheduler

Desired topology and active services SLURM super quick start guide The guide is available here. On Centos8Stream, we first install MUNGE, then install SLURM by the bzip package. Status of munge can be probed by munge -n | unmunge Installing the SLURM package is done manually wget https://download.schedmd.com/slurm/slurm-23.11.3.tar.bz2 We then unzip, configure, and build SLURM We then need to create, by the SLURM user “slurm”, the directories of log files PID files State save and make them writable. We take inspiration from an existing slurm.conf file. So the directories will be ...

The Kapitza pendulum

The Kapitza pendulum is a model in Classical mechanics that exhibits counterintuitive behaviour. It is a pendulum with a pivot point that oscillates vertically. If $\phi$ is the angle the pendulum have with respect to the vertical downward position, for some values of the driving frequency and amplitude, it can be stable in the inverted position $\phi = \pi$, and unstable in the upright position $\phi = 0$. ...

Binomial from Poisson in composite process

This is a classical calculation in Poisson processes, indicating how to obtain a binomial variable from two Poisson processes. Let $X_1(t) \sim \mathcal{P}(\lambda_1 t)$ and $X_2(t) \sim \mathcal{P}(\lambda_2 t)$ be two independent Poisson processes, with parameters $\lambda_1$ and $\lambda_2$ respectively, that can be interpreted as arrivals in a second. Let us consider the following conditional $$ \begin{align} & P[X_1(t)=k \ | \ X_1(t)+X_2(t) &= n+k] \end{align} $$ that is the probability that there are $k$ arrivals from the variable 1, conditioned on the number of total arrivals being $n+k$. $$ \begin{align} & P[X_1(t)=k \ | \ X_1(t)+X_2(t) &= n+k] = \\ &= \frac{P[X_1(t)=k, X_2(t)= n]}{P[X_1(t) + X_2(t)= n+k]} \\ &=\frac{(\lambda_1 t)^k (k!)^{-1} e^{-\lambda_1 t} (\lambda_2 t)^n (n!)^{-1} e^{-\lambda_2 t}}{((\lambda_1 + \lambda_2) t)^{n+k} ((n+k)!)^{-1} e^{-(\lambda_1+\lambda_2) t}} \\ &= \frac{(n+k)!}{n! k!}\frac{\lambda_1^k \lambda_2^n}{((\lambda_1 + \lambda_2))^{n+k}} \\ &= \binom{n+k}{k} \left(\frac{\lambda_1}{\lambda_1+\lambda_2}\right)^k \left(\frac{\lambda_2}{\lambda_1+\lambda_2}\right)^n. \end{align} $$ Here we found that this probability distribution coincides to the one of a binomial variable $$ Y \sim \text{Bin}(n+k, p) $$ where $$ p = \frac{\lambda_1}{\lambda_1+ \lambda_2} $$ This result is well rooted in our intuition: every arrival comes from process 1 or process 2, with a probability which is proportional to the arrival rate of the two processes. Expressing this results with the rates $\lambda_i$, we obtain a sum of Bernoulli variables, that boils down to the binomial variable we found.