Computational Tools for Cosmology and Applied Mathematics
Open-source computational tools spanning polynomial emulation, Monte Carlo post-analysis, and stochastic dynamics — bridging modern numerical methods with cosmological and mathematical applications.
This workspace brings together four independent but complementary Python packages, each addressing a different facet of computational science. From building fast, interpretable emulators for cosmological observables to performing global sensitivity analysis on Monte Carlo chains and solving Fokker-Planck equations, these tools share a common philosophy: make advanced numerical methods accessible, efficient, and scientifically transparent.
A general-purpose polynomial emulator based on moment projection, introduced in Zhang (2025). Given simulation data {(θ(i), y(i))}, MomentEmu constructs a moment matrix Mαβ and moment vector να, then solves the linear system M c = ν to obtain closed-form polynomial coefficients — no iterative optimisation needed.
Key properties: millisecond-level evaluation, negligible training cost (seconds, not hours), fully symbolic & differentiable output, forward (θ → y) and inverse (y → θ) modes, auto-differentiation via JAX, PyTorch, and SymPy.
The MomentEmu workflow: standardise data, assemble moment matrices, solve for polynomial coefficients, and select the optimal degree via validation RMSE.
View on GitHub →Proof-of-concept application of MomentEmu to cosmological parameter estimation using CAMB. Two emulators are provided:
Comprehensive Monte Carlo post-analysis package. Provides global sensitivity analysis (mutual information, distance correlation, permutation importance, GP surrogates with ARD, Sobol’ indices) and Monte Carlo / quasi-Monte Carlo integration with importance sampling. Modular, typed, and extensible via a registry-based plugin system.
View on GitHub →Numerical solver for the Fokker-Planck equation using the Kramers-Moyal expansion. Tracks the time evolution of probability density functions for stochastic processes, with built-in visualisation of PDF evolution at different time slices. Supports user-defined drift and diffusion coefficients.
View on GitHub →These four packages demonstrate the breadth of modern computational methods in cosmology and applied mathematics — from polynomial emulation with symbolic transparency to sensitivity analysis of Monte Carlo chains and stochastic process modelling. Each is pip-installable, documented with Jupyter notebooks, and designed for scientific transparency.
All packages are available on GitHub:
pip install git+https://github.com/zzhang0123/MomentEmu.gitpip install MC-postgit clone https://github.com/MomentEmu/MomentEmu-PolyCAMB-examples.git