Course EPS 109                                                                                                     

Computer Simulations with Jupyter Notebooks

     Instructor:Burkhard Militzer GSI: tbd tbd ... ...
     Office hours: Tu 6-7pm
4 units:   Lectures:Tu 5-6 pm
50 Birge Hall   Computer labs:Most are on Wednesdays. For time and location

Th 5-6 pm
50 Birge Hall
see UCB's schedule of classes.

EPS 109 flyer for fall 2009   
This course offers a general introduction to computer simulations for all science majors. Participants will use the Jupyter notebooks to perform calculations, design 3D graphics, and build on existing computer programs. No prior programming experience is required. The course teaches fundamental skills for scientists and helps students with future homework. It covers data processing techniques as well standard simulations methods including Monte Carlo and molecular dynamics. The algorithms are illustrated with a variety of applications in earth and planetary science as well as astronomy.

Check out our Youtube channel.

Check out the animations made by students of our fall 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021, 2022, and 2023 classes. Here is a collection of titles from past projects.

Cassini spacecraft in orbit around Saturn
Cassini spacecraft in Saturn orbit
Lorenz attractor
Choatic behavior of dynamical systems: the Lorenz attractor
Combined gravity field of sun and planet
Combined gravity field of sun and planet
Fractal fern growth
Fractal nature of ferns
Koch snowflake
Koch snowflake
Sierpinski gasket fractal
Sierpinski gasket

Selected computer lab exercises and homework assignments from our 2018 Python class:

In 2018, the class switched from using Matlab to Jupyter notebooks. While there appears to be a general trend in that direction, the real motivation was the fact that all our students' Matlab codes would stop working once they left the university and their relatively inexpensive Matlab student licenses would expire. To do the following Jupyter exercises, we recommend

1) you install Anaconda on your Mac or PC.
2) Make a new directory Jupyter in home directory and place any data files like ice_core_temperature_data.txt there.
3) Start the Jupyter system from a Terminal with the commands:
        cd ~/Jupyter
        jupyter lab
4) Start a new notebook "File->New notebook" and step-by-step paste the commands for the first lab assignment Intro_to_python_05.pdf. Press SHIFT+RETURN each time.

Type of assignmentDescriptionFiles
Lab 1Getting to know Jupyter notebooksIntro_to_python_05.pdf
Homework 1Simple calculations with Jupyter notebookshw01_course_intro13.pdf
Lab 2Pixel graphs and filling matricespixel_graphics12.pdf
Homework 2Practice making a smileyhw02_pixel_graphics_13.pdf
In this course, we generate a number of simple animations and store them as MP4 files. Here are two examples wave1d.ipynb and wave2d.ipynb that use the FFMPEG package in combination with the screen grab function. We found them more convenient than typical Python animations packages that require the user to supply the graphics for an arbitrary frame index.

Computer lab exercises and homework assignments from our 2016 Matlab class:

Type of assignmentDescriptionFiles
Lab 1Getting to know Matlab: vectors and matriceslab01_Matlab_intro.pdf
Homework 1Getting to know Matlab: loops and plotshw01_Matlab_intro.pdf
Lab 2Pixel graphics and ocean volumelab02_pixel_and_ocean_volume.pdf
Homework 2Pixel graphics and ocean volumehw02_pixel_and_ocean_volume.pdf
Lab and homework 3Logistic maplab_hw03_logistic_map.pdf
Lab 4Mandelbrot setlab04_Mandelbrot.pdf
Homework 4San Andeas fault, Mandelbrot and Newton fractalshw04_San_Andreas_fault_and_Mandelbrot.pdf
Lab and homework 5Diffusion limited aggregationlab05_DLA.pdf
Lab and homework 6Stationary state of heat equationlab06_heat.pdf
Lab and homework 7Solving the 1D heat equation in real time. Cooling of a lava dikelab07_heat_real_time.pdf
Lab and homework 8Solving the 2D heat equation and animationslab08_2D_heat.pdf
Lab 9Landscape evolution model lab09_erosion.pdf
Homework 9Erosion of a landscape you createdhw09_erosion.pdf
Lab 10Shallow water waveslab10_water_waves.pdf
Homework 10Waves over a mid-ocean ridgehw10_water_waves04.pdf
Lab and homework 11Tadpole and horseshoe orbitslab11_kepler.pdf
Homework 12Image processinghw12_image_processing.pdf
Lab and homework 13Chaos in dynamical systems: Rossler attractorlab_hw_13_roessler_attractor08.pdf

Additional examples that will be discussed in this course:

Exoplanet Orrery - Simulation of exoplanet ensembles - The orbits of the known exoplanets have been combined into a single animation.

Click on any image to play the corresponding .mp4 animation. Files are between 20 MB and 1.3 GB large. If you only see a black screen, you may have to click reload to start the animation. It is best to download the file with "Save linked file as ..." and play it back with the VLC player since it does not seem to have any issues with large files.
Animations of filled Apollonian gasket fractals

Click on any image to play the corresponding .mp4 animation. Files are between 65 and 105 MB large. They are also be started by clicking the following links: 11, 12, 13, 14, 15, 17, 19, and 20.
Diffusion limited aggregration
Diffusion limited aggregation along a sticky wall
Modified aggregation
Modified aggregation to increase the fractal dimension
Tadpole orbit
Tadpole orbit
Horseshoe orbit'
Horseshoe orbit
Molecular dynamics simulation in 2D
Molecular dynamics simulations using a Lennard-Jones pair potential
Rotating Apollonian gasket'
Apollonian gasket (here in higher resolution)

Protect yourself from lighting with a Faraday's cage by solving the Laplace equation ;=)

Dynamical simulation of the Lorenz equation
Diffusion limited aggregration
Diffusion limited aggregation along a sticky wall
Modified aggregation
Modified aggregation to increase the fractal dimension

Modified diffusion limited aggregation to grow more compact structures. Click on the images to start an animation.

Diffusion limited aggregation with two species. Click on each image to see the structures growing.

Series of fractals obtained with Newton's method in the complex plane.
Click on any image in the upper two rows to see it in 2K resolution. Here are five animations: One, two, three, four, and five.

Monte Carlo simulations of a 2D Ising spin model. In both rows of images, the temperature increases from left to right. The images in the lower row were generated by constraining the magnetization to be 50%. Click on every image to start the corresponding animation. Here is the Jupyter notebook that was used to make these animations.
Triangular fractal
Triangular fractal (click on image to start movie)
Aggregation in 3D
Aggregation in 3D (click on image to start movie)
Mandelbrot set
Mandelbrot fractal (click on image to start movie)
Julia set
Julia set (click on image to start movie)
Miro animationMiro animation
In the foot steps of Joan Miro (Higher resolution available: left and right)
In the sprit of Mondrian
In the spirit of Piet Mondrian (higher resolution available)

Landscape erosion model
Landscape evolution model (code written by former EPS109 student Jeff Prancevic)
Three movies for different models are available: movie 1, movie 2, and movie 3.
Hill erosion model
A different landscape evolution model. Click on image to start the animation.
Hill erosion model
Landscape evolution model rewritten in Python. Click on image to start the animation.
Shallow water wave of ocean ridge Shallow water wave of ocean ridge
Water wave traveling along a mid-ocean ridge. Numerical solution of the shallow water wave equation. Click on image to start animations 1 or 2 .

Labyrith generator Labyrith generator Labyrith generator Labyrith generator
Labyrinths were generated with 101 x 101, 201 x 202, and 401 x 401 resolution and also on a hexagonal grid.


Date Lecture topic Computer lab exercises
1: Introduction of course, historical overview, interplay of experiments, theory, and simulation Lab 1: Matlab as a pocket calculator
2: Fractals in nature, models and computer simulations, fractal dimension and examples in topography and coast line structure Lab 2: Loops and plots in Matlab
3: Mandelbrot set and related fractals

Tue 9/8 4: Random walks and diffusion limited aggregation (DLA), percolation theory Lab 3: Programming the Mandelbrot and Julia set
5: Group discussion on fractals
Tue 9/15 6: Numerical algorithms for finding roots and minima Lab 4: DLA in 2D on a flat sheet
Thu 9/17 7: Introduction to time independent partial differential equations (PDE), algorithms and stationary state of 1D heat equation
Tue 9/22 8: Methods to find the stationary state of 2D heat equation Lab 5: Heat equation solver in 2D
Thu 9/24 9: Time dependent PDEs, diffusion equation (heat and chemical diffusion), solution of the 1D heat equation, cooling of a lave dike
Tue 9/29 10: Landscape erosion models Lab 6: Perron’s erosion model
Thu 10/1 11: Wave equations and numerical solutions
Tue 10/6 12: Shallow water wave equation, tsunamis Lab 7: 3D water wave simulations
Thu 10/8 Midterm
Tue 10/13 13: Introduction to ordinary differential equations, Euler’s method Lab 8: Keplerian orbits
Thu 10/15 14: Newton’s law of motion, Keplerian orbits
Tue 10/2015: Planetary orbits, Hohmann transfers, spacecraft trajectoriesLab 9: Lagrange points
Thu 10/2216: Runge-Kutta method
Tue 10/2717: Lagrange points, horseshoe and tadpole orbits of asteroidsLab 10: Exercise on tadpole and horseshoe orbits
Thu 10/2918: Strange attractors
Tue 11/319: Chaotic dynamical systems and Lyaponov exponents
Lab 11: Roessler attractor
Thu 11/5 20: Simple models for climate change

Tue 11/1021: Molecular dynamics (MD)Lab 12: Box model for climate change
Thu 11/1222: Crystal structures, simulations in periodic boundary conditions
Tue 11/1723: Many particle simulationsLab 13: Molecular dynamics I
Thu 11/1924: Thermodynamic equilibrium, different states of matter
Tue 11/2425: Introduction to Monte Carlo (MC) simulationsLab 14: Molecular dynamics II
Thu 11/26Holiday
Tue 12/126: Applications of MC simulationsLab 15: Comparison of MC and MD
Thu 12/327: Curve fitting using the least-squares method, revisions, and exam preparations
Tue 12/828: Students present their movie projects, part ALab 16: Students present their movie projects, part B

Grade assignment:

The final grade will be calculated using the following percentages:

15% Grades for solving problem sets in weekly computer labs,
35% Grades for homework,
20% One midterm exam taken in class,
30% A final exam taken in class at the end of the semester.

Course description:

109. Computer simulations in Earth and Planetary Sciences (4) Two hours of lecture and two hours of computer lab exercises. Prerequisites: Math 1A or equivalent. Introduction to modern computer simulation methods and their application to selected Earth and Planetary Science problems. In hands-on computer labs, students will learn about numerical algorithms, learn to program and modify provided programs, and display the solution graphically. This is an introductory course and no programming experience is required. Examples include fractals in geophysics, properties of materials at high pressure, celestial mechanics, and diffusion processes in the Earth. Topics range from ordinary and partial differential equations to molecular dynamics and Monte Carlo simulations.


Computer simulations have become an integral part of earth and planetary science (EPS) but students arrive on campus with very different levels of computational skills. This course teaches the fundamental computational methods and their application in EPS. These skills are needed for later course work and research.

Proposed reading list:

(*) C. B. Moler, “Numerical Computing with Matlab”, Society for Industrial and Apllied Mathematics (SIAM) Philadelphia, 2004, QA 297 M625 2004 ENGI, pages 14, 120, 187, 203, available online:


(*) H.-O. Peitgen, D. Saupe (ed), The Science of Fractal Images”, Springer Verlag 1988, QA 614 .86 S351 1998 MATH, pages 40, 44, 50, 147, 155,

(*) D. L. Turcotte, “Fractals and Chaos in Geology and Geophysics”, Cambridge, U.K. ; New York : Cambridge University Press, 1997, page 14, 22,45, 59, 69, 71, 91, 97, 149, 201, 235, 299

(*) H.-O. Peigten, H. Jurgens, D. Saupe, “Fractals for the Classroom Part II Complex Systems and Mandelbort Set”, Springer 1992, QA 614 .86 P45 1992 v.2 MATH, pages 27. 58, 127, 199, 304, 318, 381, 401, 420, 446, 453.

(*) B. B. Mandelbrot, “The Fractal Geometry of Nature”, W.H. Freeman and Co. NY 1983,  QA 447 M357 1983 MATH, pages 30, 112,

D.J. Higham, N. J. Highham, “Matlab Guide”. Society for Industrial and Apllied Mathematics (SIAM) Philadelphia, 2000, QA 297 H5217 2000 ENGI, pages 14, 17, 90, , 132, 178, 221, 246.

A. Stanoyevitch, “Introduction to MATLAB with Numercial Preliminaries” Wiley 2004, TA 345 S75 2004 ENGI, pages 177.

J. Feder, “Fractals” Plenuym Press, NY, 1988, QA 447 F371 1998 MATH.

Ordinary Differential Equations, Molecular Dynamics, Solar System Dynamics:

J.H. Mathews, K.D. Fink, “Numerical Methods Using Matlab”, 4th edition, Pearson Education Inc., 2004, QA 297 M39 2004 ENGI, pgaes: 262, 418, 434, 465, 496, 505, 544, 557, 567,

(*) J. B. Marion, S. T. Thornton, “Classical Dynamics of particles and systems”, Saunders College Publishing, Fort Worth Philadelphia.

C.D. Murray, S.F Dermott, “Solar Systems Dynamics”, Cambridge University Press, 1999.

I. De Pater, J.J. Lissauer, “Planetary Science”, Cambridge University Press, 2001.

M. P. Allen, D.J. Tildesley, “Computer Simulations of Liquids”, Oxford University Press.

S. Nakamura, “Numerical Analysis and Graphic Visualization with Matlab” 2nd edition, Prentice Hall PTR 2001, T 385 N34 2002 ENGI, pages 63, 302, 385, 396, 453, 465.

W. J. Palm III, “Introduction to Matlb 6 for Engineers”, McGraw-Hill, 2001, TA 345 P35 2001 ENGI, pages  452.

H. B. Wilson, L. H Turcotte, “Advanced Mathematics and Mechanics Applications Using Matlab”, 2nd edition, CRC Press 1997, TA 354 W55 1997 ENGI, pages: 271, 352, 382.

A.H.Nayfeh, B. Balachandram, “Applied Nonlinear Dynamics, Analytical Computational, and Experimental Maethods”, Wiley, QA 845 N39 1994 ENGI.

E. A. Jackson, “Perspectives of Non-linear Dynamics”, Cambridge University Press, 1989, QA 845 J28 1989 V.1 ENGI

V.S. Anishchenko, V. Astakhov, A. Neiman, T. Vadivasova, L. Schimansky-Geier, “Nonlinear Dynamics of Chaotic and Stochastic Systems” Springer 2007, QA 845 .N667 2007 ENGI, pages 110.

Monte Carlo:

M. H. Kalos, P. A. Whitlock, “Monte Carlo Methods”, John Wiley & Sons, NY.

Partial Differential Equations:

(*) D. L. Turcotte and G. Schubert, “Geodynamics”, Cambridge ; New York : Cambridge University Press, 2002.

X.-S. Yang, “An Introduction to Computational Engineering with Matlab”, Cambridge International Science Publishing, 2006, TA 345 Y36 2006 ENGI, pages 33, 53, 57, 79, 224

W. E. Boyce, R. DiPirma, “Elementary Differential Equations and Boundary Value Problems”, Textbook, John Wiley & Sons, NY.


K. Mcguffie, A. Henderson-Sellers, “A Climate modeling Primer”, Wiley 1997, QC 981 M482 1997 EART, page 85

(*) indicates the most relevant books.