What is a basis function expansion?

In the Milky Way, the density, potential, velocity, energy, angular momentum and chemical abundance patterns fluctuate across the disk. More generally, fields in galaxies – and other physical systems – often vary in complex manners that cannot be captured with simple, analytic formulae. In simulations, these fluctuations are described in simulations by particles representing random draws from the full field. In the Milky Way, the fluctuations are captured in the spatial density of stars. In observations of other galaxies, the fluctuations are reflected in the properties of light captured in a pixel. A full description often requires millions or even hundreds of millions of numbers.

A well-designed Basis Function Expansion can typically capture the salient features of a complex field in 1000’s of numbers, providing a succinct description. It does so by representing the full field in a series of basis functions that span function space. The information in the field is captured in the coefficients of each basis function in the expansion. For large enough numbers of basis functions, any field can be represented. However, BFE’s become truly powerful if they can be tailored to the application, so the information can be captured in as few terms as possible.

The best-known examples of a BFE are Fourier series of sines and cosines, which are very good at capturing variations in time or space that repeat with a small set of regular periods. In a galactic dynamics context, the optimal basis will resemble the galaxy, with additional functions to capture variance or deviations from the simplest axisymmetric model. In N-body simulations of galaxies, BFEs have been used to derive potential fields at each timestep from particle data at computational effort proportional to the number of particles – drastically less computationally intense than other techniques to determine potentials Hernquist (1992).

More generally: in theoretical analyses, BFE have been partnered with mathematical tools of perturbation theory and linear algebra to solve equations, to describe interactions and identify physical mechanisms such as in the interaction of the Milky Way and Large Magellanic Cloud (Weinberg & Blitz 2006). Additionally, BFE have been used in observations to compress vast data sets and allow interpretation, such as in the power spectrum of fluctuations in the temperature of the Cosmic Microwave Background (Spergel et al. 2007).

Exp = Adaptive BFEs: precision and concision in the language

Exp provides numerical tools that derive efficient representations of BFEs from linear combinations of an initial set of functions based on the character of the data, providing a concise description that minimizes the degrees of freedom while efficiently capturing the properties of the fields. At the same time, the description is more precise in its representation of the fields. These distillations provide opportunities to store and reuse key dynamical content in easy-to-reconstruct field form. Applications include resampling phase space at higher resolution than the original simulation, replaying the time-evolving fields to study their influence on ensembles of orbits that may represent stellar streams, star clusters, dwarf galaxies, dark matter substructure, just to name a few.

Exp = BFE+mSSA: finding the story being told by BFE’s

EXP also provides tools that correlate the morphology and time dependence of dominant features contributing to the evolution of a field from multiple sets of expansion coefficients. By adding correlations in the time domain to the correlations represented by the BFEs, the dynamical content of temporal variation becomes manifest. This automatic spatio-temporal discovery is a form of unsupervised learning and has already led to discovery of new, previously unknown, dynamics in our simulations. EXP implements multivariate Singular Spectrum Analysis (SSA) – an unsupervised machine learning algorithm – tailored to basis-function expansions. SSA decomposes the BFE variation in time into interpretable components and provides for spectral estimation without specific assumptions about the time dependence of the system. We also provide some preliminary support for dynamical mode decomposition (DMD) and other Koopman-related techniques.

EXP : applications to cosmology

EXP can be used to analyze structure in cosmological simulations. Members of the EXP Collaboration are applying these tools to snapshots from simulations of galaxy formation to:

Exp : the code and the collaboration

Exp is designed to connect: (1) theoretical descriptions of dynamics, (2) N-body simulations, and (3) data-efficient descriptions of their natural consequences. Exp provides recent developments from applied mathematics and numerical computation to represent time series of BFEs that describe the temporal variation of any field in space. In the context of galactic dynamics, these fields may be density, potential, force, velocity fields or any intrinsic field produced by simulations such as chemistry data. By combining the coefficient information through time using spectral analysis, we hope to discover the dynamics of galaxy evolution directly from simulations and by predictive comparison with observed data.

The Exp Collaboration is exploring the applications of these tools to galactic dynamics, from the Milky Way disk to cosmological simulations of galaxy formation. Our team combines expertise in (i) analytic models, (ii) numerical simulations and (iii) data analysis. We aim to build a language that unites all three. We use Basis Function Expansions (BFE) to compactly summarize spatial or velocity features in simulations and multivariate Singular Spectrum Analysis (mSSA) to discover the non-linear dynamics of their interaction. This allows us to detect deep dynamical relationships in our simulations. The approach promises multiple connections: from observations to simulations to theoretical descriptions; between galactic components; and across phase-space dimensions.

EXP: applications to dynamical systems

Density/potential pairs of BFEs that are solutions to Poisson’s equation provide a natural language for dynamics. They are used both in simulations and analytic calculations, and hence can be used to link the two.

In addition to its analysis framework, EXP includes an N-body gravitational code. The resulting simulations output both particle-based snapshot data and BFE information, including the basis and time-evolving coefficients. The theory underpinning EXP simulations and the implementation are discussed in more detail in the , as well as these papers (, ).

The collaboration has applied EXP to various simulations to:

  • Follow the evolution of galactic bars (), as well as its interaction with a dark matter halo ()
  • Distinguish intrinsic halo instabilities from evolution driven by disk/halo coupling in the simulation of an isolated galaxy (https://ui.adsabs.harvard.edu/abs/2023MNRAS.521.1757J/abstract Johnson, Petersen et al 2023);
  • Isolate the signatures of multiple interacting satellites in a simulated galactic disk (Petersen et al 2025, in prep);
  • Connect features found in phase-space local patches of a simulated disk into global structures (Tavangar et al 2025, in prep);
  • Characterize the morphological transformation of the SMC and LMC as they orbit our Milky Way (Rathore et al 2025, in prep)

EXP: applications to observations

Two dimensional basis function expansions can also be performed on observational data. As shown in Ganapathy et al 2025, 2D expansions on image data can be used to describe the light (stellar) distribution in a galaxy, and provide a language for succinctly, quantitatively summarizing the morphological features. A Fourier-Laguerre basis is a natural choice for expanding imaging data, capturing both the angular (Fourier) and radial (Laguerre) information. Expansions using this basis can be used to quantify lopsidedness in galaxies (e.g. Ganapathy et al 2025), measure galaxy inclination (e.g. Martinez et al, in prep), and identify morphological features like bars. These expansions are also how we map an image of a (into a sound ) via sonification. Similarly, we can perform expansions of integral field spectrograph data, which allow for analyses of both velocity and chemical information.

Looking Forward

  • Time series analyses more generally
    • DMD
    • Advanced mSSA techniques
  • Other fields in galaxies
    • Velocity
    • Chemistry
    • Ages
  • Other applications beyond galaxies
    • Accretion disks
    • Planetary disks
    • Astrophysical Plasmas
    • Proto-stellar disks

How to get started

We have built and compiled a variety of resources to help you get started with Exp and basis function expansions!

Check out our GitHub page and accompanying for how to install EXP.

If you want to experiment with EXP, try out the Docker image and documentation. If you want to run pyEXP and EXP examples, be sure to clone the respective repositories to wherever you are working with the Docker image

If you want to want to learn more about mSSA, check out this webpage and these papers: 1 and 2 (see also the EXP readthedocs for more information)