Hands-on codes for VIASM 2025 summer school on advanced numerical methods for deterministic and stochastic differential equations.
The lectures that introduce and motivate these codes are available on Google Drive: https://tinyurl.com/viasm-anm2025.
These codes require a modern Python installation, a few standard Python modules, and the git command for interacting with GitHub. The following step-by-step instructions guide you in installing Anaconda, downloading code from GitHub, and running the code in Spyder. These steps are suitable for both Windows and MacOS users.
For Windows & macOS
-
Go to the Anaconda website:
-
Download the Installer:
-
Click Download
-
Choose the version for your operating system (Windows or MacOS).
-
Download the 64-bit Graphical Installer.
-
-
Install Anaconda:
-
Windows: Double-click the
.exefile and follow the setup instructions. -
Mac: Double-click the
.pkgfile and follow the prompts.
Tip: Leave all settings at their defaults unless you have specific needs. On Windows, you may want to check "Add Anaconda to my PATH environment variable" (optional but useful).
-
Open Anaconda Navigator from your Start Menu (Windows) or Applications folder (MacOS).
-
Install Git (if you don't have this already):
Download from https://git-scm.com/downloads and install using default settings.
-
Open Anaconda Prompt (Windows) or Terminal (Mac).
-
Navigate to the folder where you want to save the code:
cd path/to/your/folderwhere you replace
path/to/your/folderwith the path to your desired folder. -
Clone the repository:
git clone https://github.com/drreynolds/viasm.git
-
Go to the GitHub repository page in your web browser.
-
Click the green Code button, then select Download ZIP.
-
Extract the ZIP file to your preferred location.
To install the Python packages that are used by the codes in this repository, use Anaconda Prompt/Terminal from the folder containing the downloaded/cloned code:
pip install -r python_requirements.txtRun the desired Python script directly at the command-line:
python scriptname.pywhere scriptname.py is the name of the script you wish to run.
-
Launch Spyder:
-
In Anaconda Navigator, locate Spyder.
-
If not already installed, click Install.
-
After installation, click Launch to open Spyder.
-
-
Open and run the code in Spyder
-
In Spyder, go to File > Open.
-
Navigate to the folder containing the downloaded/cloned code.
-
Select the
.pyfile you want to run and open it. -
Press the green Run button (Play icon) in Spyder to execute your script.
-
Files that begin with capital letters contain Python classes and user-callable functions. Files that begin with lower-case letters contain scripts that run various demos. These are grouped as follows:
Basic Python demos:
-
numpy_demo.py-- simple script showing Numpy usage. -
plotting_demo.py-- simple script showing how to generate plots.
-
ForwardEuler.py-- simple baseline explicit IVP time-stepper class. -
ERK.py-- explicit Runge--Kutta IVP time-stepper class. -
driver_explicit_fixed.py-- script to test explicit fixed-step methods. -
driver_explicit_stability.py-- script to demonstrate stability limitations of explicit methods. -
ImplicitSolver.py-- reusable nonlinear solver class for implicit IVP methods. -
BackwardEuler.py-- simple baseline implicit IVP time-stepper class. -
DIRK.py-- diagonally-implicit Runge--Kutta IVP time-stepper class. -
driver_implicit_fixed.py-- script to test implicit fixed-step methods.
-
AdaptERK.py-- explicit Runge--Kutta adaptive IVP solver class. -
driver_explicit_adaptive.py-- script to test explicit adaptive-step methods. -
AdaptDIRK.py-- implicit Runge--Kutta adaptive IVP solver class. -
driver_implicit_adaptive.py-- script to test implicit adaptive-step methods. -
driver_adaptive_timescale.py-- script to demonstrate how adaptive solvers track dynamical time scales. -
driver_adaptive_stability.py-- script to demonstrate how adaptive solvers can assess stiffness.
-
LTSubcycling.py-- simple fixed-step Lie--Trotter subcycling IVP time-stepper class. -
SMSubcycling.py-- simple fixed-step Strang--Marchuk subcycling IVP time-stepper class. -
MRI.py-- higher-order fixed-step multirate infinitesimal (MRI) IVP time-stepper class. -
driver_multirate.py-- script to demonstrate accuracy differences for various multirate methods.
RK_stability.py-- function to plot linear stability regions for Runge--Kutta methods.