# DifferentialEquations.jl Documentation

This is a suite for numerically solving differential equations in Julia. The purpose of this package is to supply efficient Julia implementations of solvers for various differential equations. Equations within the realm of this package include:

Discrete equations (function maps, discrete stochastic (Gillespie/Markov) simulations)

Ordinary differential equations (ODEs)

Split and Partitioned ODEs (Symplectic integrators, IMEX Methods)

Stochastic ordinary differential equations (SODEs or SDEs)

Random differential equations (RODEs or RDEs)

Differential algebraic equations (DAEs)

Delay differential equations (DDEs)

Mixed discrete and continuous equations (Hybrid Equations, Jump Diffusions)

(Stochastic) partial differential equations ((S)PDEs) (with both finite difference and finite element methods)

The well-optimized DifferentialEquations solvers benchmark as the some of the fastest implementations, using classic algorithms and ones from recent research which routinely outperform the "standard" C/Fortran methods, and include algorithms optimized for high-precision and HPC applications. At the same time, it wraps the classic C/Fortran methods, making it easy to switch over to them whenever necessary. It integrates with the Julia package sphere, for example using Juno's progress meter, automatic plotting, built-in interpolations, and wraps other differential equation solvers so that many different methods for solving the equations can be accessed by simply switching a keyword argument. It utilizes Julia's generality to be able to solve problems specified with arbitrary number types (types with units like Unitful, and arbitrary precision numbers like BigFloats and ArbFloats), arbitrary sized arrays (ODEs on matrices), and more. This gives a powerful mixture of speed and productivity features to help you solve and analyze your differential equations faster.

If you have any questions, or just want to chat about solvers/using the package, please feel free to use the Gitter channel. For bug reports, feature requests, etc., please submit an issue. If you're interested in contributing, please see the Developer Documentation.

## Supporting and Citing

The software in this ecosystem was developed as part of academic research. If you would like to help support it, please star the repository as such metrics may help us secure funding in the future. If you use JuliaDiffEq software as part of your research, teaching, or other activities, we would be grateful if you could cite our work. Please see our citation page for guidelines.

## Getting Started: Installation And First Steps

To install the package, use the following command inside the Julia REPL:

`Pkg.add("DifferentialEquations")`

To load the package, use the command:

`using DifferentialEquations`

The command `Pkg.add("DifferentialEquations")`

will add solvers and dependencies for all kind of Differential Equations (e.g. ODEs or SDEs etc., see the Supported Equations section below). If you are interested in only one type of equation solvers of `DifferentialEquations.jl`

or simply want a more lightweight version, see the Low Dependency Usage page.

To understand the package in more detail, check out the following tutorials in this manual. **It is highly recommended that new users start with the ODE tutorial**. Example IJulia notebooks can also be found in DiffEqTutorials.jl. If you find any example where there seems to be an error, please open an issue.

For the most up to date information on using the package, please join the Gitter channel.

Using the bleeding edge for the latest features and development is only recommended for power users. Information on how to get to the bleeding edge is found in the developer documentation.

### IJulia Notebook Tutorials

You can access extra tutorials supplied in the DiffEqTutorials.jl repository. If you have IJulia installed, you can view them locally and interactively, by cloning the repository:

```
#Pkg.add("IJulia") # Need to do this the first time to install IJulia!
Pkg.clone("https://github.com/JuliaDiffEq/DiffEqTutorials.jl")
using IJulia
notebook(dir = Pkg.dir("DiffEqTutorials"))
```

### Tutorials

The following tutorials will introduce you to the functionality of DifferentialEquations.jl. More examples can be found by checking out the IJulia notebooks in the examples folder.

- Ordinary Differential Equations
- Example 1 : Solving Scalar Equations
- Example 2: Solving Systems of Equations
- Defining Parameterized Functions
- Example 3: Using Other Types for Systems of Equations
- Going Beyond ODEs: How to Use the Documentation
- Stochastic Differential Equations
- Example 1: Scalar SDEs
- Example 2: Systems of SDEs with Diagonal Noise
- Example 3: Systems of SDEs with Scalar Noise
- Example 4: Systems of SDEs with Non-Diagonal Noise
- Example 4: Colored Noise
- Delay Differential Equations
- Differential Algebraic Equations
- Discrete Stochastic (Gillespie) Equations
- Defining a Model using Reactions
- Building and Solving the Problem
- Using the Reaction Network DSL
- Defining the Jumps Directly
- Adding Jumps to a Differential Equation
- Adding a VariableRateReaction
- Jump Diffusion Equations
- Boundary Value Problems
- Poisson Equation Finite Element Method
- Heat Equation Finite Element Method
- Stochastic Finite Element Method

### Basics

These pages introduce you to the core of DifferentialEquations.jl and the common interface. It explains the general workflow, options which are generally available, and the general tools for analysis.

- Overview of DifferentialEquations.jl
- Defining Problems
- Solving the Problems
- Analyzing the Solution
- Add-on Tools
- Development and Testing Tools
- Common Solver Options
- Default Algorithm Hinting
- Output Control
- Stepsize Control
- Miscellaneous
- Progress Monitoring
- User Data
- Error Calculations
- Examples
- Solution Handling
- Accessing the Values
- Array Interface
- Using the AbstractArray Interface
- Interpolations
- Comprehensions
- Special Fields
- Return Codes (RetCodes)
- Problem-Specific Features
- Plot Functions
- Standard Plots Using the Plot Recipe
- Density
- Choosing Variables
- Animations
- Plotting Without the Plot Recipe
- Integrator Interface
- Frequently Asked Questions
- Solver Compatibility Chart

### Problem Types

These pages describe building the problem types to define differential equations for the solvers, and the special features of the different solution types.

- Discrete Problems
- ODE Problems
- Dynamical, Hamiltonian and 2nd Order ODE Problems
- Mathematical Specification of a Dynamical ODE Problem
- Mathematical Specification of a 2nd Order ODE Problem
- Hamiltonian Problems
- Split ODE Problems
- Steady State Problems
- BVP Problems
- SDE Problems
- RODE Problems
- DDE Problems
- DAE Problems
- Jump Problems
- FEM Problems

### Solver Algorithms

These pages describe the solvers and available algorithms in detail.

- Discrete Solvers
- Full List of Methods
- ODE Solvers
- Full List of Methods
- OrdinaryDiffEq.jl
- Sundials.jl
- ODEInterface.jl
- LSODA.jl
- ODE.jl
- MATLABDiffEq.jl
- GeometricIntegrators.jl
- BridgeDiffEq.jl
- TaylorIntegration.jl
- List of Supplied Tableaus
- Dynamical, Hamiltonian, and 2nd Order ODE Solvers
- Split ODE Solvers
- Steady State Solvers
- Full List of Methods
- BVP Solvers
- Full List of Methods
- SDE Solvers
- Full List of Methods
- RODE Solvers
- Full List of Methods
- DDE Solvers
- DAE Solvers
- Full List of Methods
- FEM Poisson Solvers
- Full List of Methods
- FEM Heat Solvers
- Full List of Methods

### Additional Features

These sections discuss extra performance enhancements, event handling, and other in-depth features.

- Performance Overloads
- Declaring Explicit Jacobians
- Declaring Explicit Jacobians for DAEs
- Other Available Functions
- Symbolically Calculating the Functions
- DiffEq-Specific Array Types
- DiffEqOperators
- Noise Processes
- Using Noise Processes
- Noise Process Types
- Non-Standard Noise Processes
- Examples Using Non-Standard Noise Processes
- Specifying (Non)Linear Solvers
- Event Handling and Callback Functions
- Introduction to Callback Functions
- The Callback Types
- Using Callbacks
- DiscreteCallback Examples
- ContinuousCallback Examples
- Callback Library
- Manifold Conservation and Projection
- AutoAbstol
- PositiveDomain
- GeneralDomain
- Stepsize Limiters
- FunctionCallingCallback
- Parallel Monte Carlo Simulations
- Performing a Monte Carlo Simulation
- Analyzing a Monte Carlo Experiment
- Example 1: Solving an ODE With Different Initial Conditions
- Example 2: Solving an SDE with Different Parameters
- Example 3: Using the Reduction to Halt When Estimator is Within Tolerance
- Example 4: Using the Analysis Tools
- I/O: Saving and Loading Solution Data
- Low Dependency Usage
- Meshes
- Juno Progress Bar Integration

### Analysis Tools

Because DifferentialEquations.jl has a common interface on the solutions, it is easy to add functionality to the entire DiffEq ecosystem by developing it to the solution interface. These pages describe the add-on analysis tools which are available.

- ParameterizedFunctions
- The AbstractParameterizedFunction Interface
- ParameterizedFunction Constructor
- Function Definition Macros
- Finite Element Method Macros
- Parameter Estimation
- Recommended Methods
- Local Optimization Examples
- More Algorithms (Global Optimization) via MathProgBase Solvers
- Bifurcation Analysis
- Sensitivity Analysis
- Uncertainty Quantification
- ProbInts
- Example 1: FitzHugh-Nagumo
- Example 2: Adaptive ProbInts on FitzHugh-Nagumo
- Example 3: Adaptive ProbInts on the Lorenz Attractor
- Algorithm Development and Testing

### Modeling Tools

While DifferentialEquations.jl can be used to directly build any differential or difference equation (/ discrete stochastic) model, in many cases it can be helpful to have a tailored-built API for making certain types of common models easier. This is provided by the modeling functionality.

### Extra Details

These are just assorted extra explanations for the curious.

## Acknowledgements

JuliaDiffEq and DifferentialEquations.jl has been a collaborative effort by many individuals. Significant contributions have been made by the following individuals:

Chris Rackauckas (@ChrisRackauckas) (lead developer)

Yingbo Ma (@YingboMa)

David Widmann (@devmotion)

Hendrik Ranocha (@ranocha)

Shivin Srivastava (@shivin9)

Ayush Pandey (@Ayush-iitkgp)

Ethan Levien (@elevien)

Tom Short (@tshort)

@dextorious