question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrating the Sympy-based Boltzmann solver from PyCosmo

See original GitHub issue

Following a very nice talk from Beatrice Moser, I looked a little bit at how PyCosmo is implementing their own Boltzmann code and it’s actually pretty nice and could be pretty easily ported to JAX I think.

The ODE is specificied using Sympy, which makes it pretty easy to write down the equations, and then they use their own sympy2c code to transform the python code into JIT compiled code to run the actual ODE solver.

So that’s pretty cool 😃 But we could make it way cooler by doing the following:

  • Copy/Paste the Sympy equations from PyCosmo (which is GPL licensed)
  • Use Miles’ sympy2jax library https://github.com/MilesCranmer/sympy2jax to turn the equations into JAX functions
  • Use jax.experimental.odeint to integrate in time the system
  • Profit!

And boom! You got yourself a diffable Boltzman solver!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EiffLcommented, Jan 31, 2022

Also I’m thinking it would be worthwhile to host a JAX Boltzmann solver as a separate project, as opposed to integrating it directly into jax-cosmo.

0reactions
moserb94commented, Feb 2, 2022

The idea was to use hyrec-2 the way we use RecFast++ (meaning a python wrapper and an interpolator), rather than rewriting the code in sympy… so that wouldn’t help I guess.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyCosmo: An Integrated Cosmological Boltzmann Solver - arXiv
We present PyCosmo, a new Python-based framework to solve this set of equations using a special pur- pose solver based on symbolic manipulations ......
Read more >
Issues · DifferentiableUniverseInitiative/jax_cosmo - GitHub
Migration integration: ClenshawCurtis ... Integrating the Sympy-based Boltzmann solver from PyCosmo Cosmology Issue related to implementing cosmology ...
Read more >
PyCosmo: an integrated cosmological Boltzmann solver ...
The symbolic representation of the Einstein–Boltzmann equation system in PyCosmo provides a convenient interface for implementing extended cosmological models.
Read more >
[PDF] PyCosmo: An integrated cosmological Boltzmann solver
Semantic Scholar extracted view of "PyCosmo: An integrated cosmological Boltzmann solver" by A. Réfrégier et al.
Read more >
arXiv:1708.05177v1 [astro-ph.CO] 17 Aug 2017 - Scinapse
PyCosmo : An Integrated Cosmological Boltzmann Solver ... Keywords: Cosmology, Boltzmann Equation, Differential Equations, Python.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found