Skip to content
/ ncf Public

Nature's Cost Function (NCF). Finding paths of least action with gradient descent.

Notifications You must be signed in to change notification settings

greydanus/ncf

Repository files navigation

logo.png

compare.gif

Blog post 1 | Blog post 2 | Paper

Colab: Simple tutorial | Colab: Reproduce paper figures | Colab: Quantum path integral tutorial

In physics, there is a scalar function called the action which behaves like a cost function. When minimized, it yields the "path of least action" which represents the path a physical system will take through space and time. This function is crucial in theoretical physics and is usually minimized analytically to obtain equations of motion for various problems. In this paper, we propose a different approach: instead of minimizing the action analytically, we discretize it and then minimize it directly with gradient descent. We use this approach to obtain dynamics for six different physical systems and show that they are nearly identical to ground-truth dynamics. We discuss failure modes such as the unconstrained energy effect and show how to address them. Finally, we use the discretized action to construct a simple but novel quantum simulation.

hero.png

How to run

Six Experiments

Core physics code can be found in core_physics.py.

  • Free body
    • Minimal working example
  • Single Pendulum
    • Minimal working example with nonlinearities and radial coordinates
  • Double pendulum
    • A chaotic system with sharp nonlinear dynamics
  • Three body problem
    • A chaotic system with sharp nonlinear dynamics and N=6 degrees of freedom
  • Gas simulation
    • A chaotic system with sharp nonlinear dynamics and N=100 degrees of freedom
  • Ephemeris dataset
    • A real physics data taken from the JPL Horizons project
    • One year of orbital data for the sun and the inner planets of the solar system
    • Orbits are projected onto a 2D plane

results.png

Quantum simulation

Code for our quantum experiments can be found in quantum_tutorial.py.

quantum.png

Depedencies

  • PyTorch pip install torch
  • Pandas pip install pandas
  • Celluloid (making videos) pip install celluloid

About

Nature's Cost Function (NCF). Finding paths of least action with gradient descent.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published