SciPy 2026

Computational Methods for Simulation using JAX and NumPy (Room HSEC 2-110)
2026-07-14 , Accelerated Computing

This tutorial demonstrates how to accelerate agent-based simulations using modern Python tools. Using Thomas Schelling's classic segregation model as a running example, participants will learn to transform readable but slow Python code into high-performance implementations using NumPy and JAX. The tutorial explores how mild individual preferences can lead to extreme aggregate outcomes through simulation, while teaching practical techniques for leveraging modern hardware (including GPUs) to make realistic large-scale simulations computationally feasible. Participants will gain hands-on experience with performance optimization strategies applicable to economic modeling, urban planning, epidemiology, and other domains requiring large-scale agent-based simulations.

Installation Instructions: https://github.com/QuantEcon/scipy_tutorial_2026


Simulation is a critical methodology for policy analysis across economics, public health, urban planning, and environmental science. Examples include DSGE models for monetary policy, pension reform analysis, climate policy evaluation, and agent-based urban models. However, realistic simulations often require tracking thousands or millions of agents over many time periods, making computational efficiency essential.

This tutorial addresses the computational challenges of simulation through a concrete, historically significant example: Thomas Schelling's 1969 segregation model, which earned him the 2005 Nobel Prize in Economic Sciences. The model demonstrates a surprising result: extreme residential segregation can emerge even when individuals have only mild preferences for same-type neighbors. This finding has profound implications for understanding persistent urban segregation patterns observed in American cities.

We begin with an intuitive object-oriented Python implementation that prioritizes readability, then systematically optimize performance through:

  1. Array-based computing with NumPy
  2. Just-in-time compilation and GPU acceleration with JAX
  3. Parallelization strategies for modern hardware

Through live coding demonstrations and hands-on exercises, participants will transform a slow baseline implementation (taking minutes) into a highly optimized version (running in seconds) capable of simulating realistic urban scenarios with tens of thousands of agents. The tutorial emphasizes transferable skills, and the optimization patterns learned apply broadly to agent-based models in computational science.

The tutorial also explores the substantive implications of the model, connecting computational results to real-world segregation patterns and policy questions. Participants will see how computational tools enable researchers to test hypotheses about social dynamics that would be impossible to study analytically.


Prerequisites:

Python Programming

Participants should be comfortable with:

  • Core Python syntax (variables, loops, conditionals, functions)
  • Basic data structures (lists, dictionaries, tuples)
  • Object-oriented programming concepts (classes, methods, attributes)
  • Working with Jupyter notebooks or similar interactive environments

Basic Mathematics

Understanding of:

  • Euclidean distance and coordinate geometry
  • Basic probability concepts (random sampling, distributions)
  • No advanced mathematics required

Helpful But Not Required

  • Familiarity with NumPy arrays and array operations
  • Experience with any agent-based modeling framework
  • Understanding of GPU computing concepts
  • Prior exposure to functional programming ideas
Installation Instructions:

https://github.com/QuantEcon/scipy_tutorial_2026

Smit Lunagariya is a Machine Learning Engineer at Google and an active contributor to the scientific Python and open-source ecosystems. He holds an Integrated Dual Degree (Bachelor's and Master's) in Mathematics and Computing Engineering from the Indian Institute of Technology (BHU), Varanasi.

His involvement in open source began with Google Summer of Code in 2020 and has since expanded to include contributions to several scientific computing projects, including SciPy, SymPy, LPython, LFortran, QuantEcon, and Aesara.