# Nondimensionalization

Here's a simple but interesting bit of math that came up while working on an implementation of Jakob and Hanika (2019). The reflectivity model they proposed is: $$R(\lambda) = \sigma(c_0\lambda^2 + c_1\lambda + c_2)$$ where $c_0, c_1, c_2$ are model parameters, $\lambda \in [360~\mathrm{nm}, 830~\mathrm{nm}]$ and $\sigma: \mathbb{R} \rightarrow [0,1]$ is a sigmoid function. Reflectivities tend to be rather smooth and the values of the polynomial not too large. If wavelengths are expressed numerically in nanometers, $c_1$ and especially $c_0$ will tend to be very small. This makes it harder to find minima of the function, as solvers tend get confused, unless special care is taken to change the default tolerances properly.

A more straightforward solution is to rescale $\lambda$ to a more convenient range, a process a physicist would call *nondimensionalization*. Following the authors of the article, let
$$\lambda' = \frac{\lambda - 360~\mathrm{nm}}{830~\mathrm{nm} - 360~\mathrm{nm}}$$
so that $\lambda' \in [0, 1]$ (and no longer has a physical unit) and
$$R(\lambda') = \sigma(c_0'\lambda'^2 + c_1'\lambda + c_2')$$
This makes solvers far more likely to converge, without having to fine tune their settings.

## Recovering the units

The interesting part is that having found the primed parameters, one can recover the unprimed ones. Start by equating $R(\lambda)$ and $R(\lambda')$, $$\sigma(c_0\lambda^2 + c_1\lambda + c_2) = \sigma(c_0'\lambda'^2 + c_1'\lambda + c_2')$$ Because $\sigma$ is invertible, its inverse can be applied to both sides of the equation, resulting in an equality between the arguments. Then, replace $\lambda'$ with its definition and expand the right hand side, $$c_0\lambda^2 + c_1\lambda + c_2 = \frac{c_0'}{220900~\mathrm{nm}^2}\lambda^2 + \left(-\frac{36 c_0'}{11045~\mathrm{nm}} + \frac{c_1'}{470~\mathrm{nm}}\right)\lambda + \frac{1296}{2209}c_0' - \frac{36}{47}c_1' + c_2'$$ Because the equation must hold for all $\lambda$, equate the two quadratic polynomials' coefficients to get the final answers.