# "Projection" Method for NDSolve

## Introduction

When a differential system has a certain structure, it is advantageous if a numerical integration method preserves the structure. In certain situations it is useful to solve differential equations in which solutions are constrained. Projection methods work by taking a time step with a numerical integration method and then projecting the approximate solution onto the manifold on which the true solution evolves.

NDSolve includes a differential algebraic solver which may be appropriate and is described in more detail within "Numerical Solution of Differential-Algebraic Equations".

Sometimes the form of the equations may not be reduced to the form required by a DAE solver. Furthermore so-called index reduction techniques can destroy certain structural properties, such as symplecticity, that the differential system may possess (see [HW96] and [HLW02]). An example that illustrates this can be found in the documentation for DAEs.

In such cases it is often possible to solve a differential system and then use a projective procedure to ensure that the constraints are conserved. This is the idea behind the method .

If the differential system is -reversible then a *symmetric* projection process can be advantageous (see [H00]). Symmetric projection is generally more costly than projection and has not yet been implemented in NDSolve.

### Invariants

Consider a differential equation

where may be a vector or a matrix.

**Definition**: A nonconstant function is called an *invariant* of (1) if for all .

This implies that every solution of (2) satisfies .

Synonymous with invariant, the terms *first integral*, *conserved quantity*, or *constant of the motion* are also common.

### Manifolds

Given an -dimensional submanifold of with

Given a differential equation (3) then implies for all . This is a weaker assumption than invariance and is called a weak invariant (see [HLW02]).

### Projection Algorithm

Let denote the solution from a one-step numerical integrator. Considering a constrained minimization problem leads to the following system (see [AP91], [HW96] and [HLW02]):

To save work is approximated as . Substituting the first relation into the second relation in (4) leads to the following simplified Newton scheme for :

The first increment is of size so that (5) usually converges quickly.

The added expense of using a higher-order integration method can be offset by fewer Newton iterations in the projective step.

For the termination criterion in the method , the option is combined with one Unit in the Last Place in the working precision used by NDSolve.

## Examples

In[3]:= |

### Linear Invariants

In[5]:= |

In[7]:= |

Out[7]= |

In[8]:= |

Out[9]= |

Therefore in this example there is no need to use the method .

Certain numerical methods preserve quadratic invariants exactly (see for example [C87]). The implicit midpoint rule, or one-stage Gauss implicit Runge–Kutta method, is one such method.

### Harmonic Oscillator

In[10]:= |

In[12]:= |

Out[12]= |

In[13]:= |

Out[14]= |

In[15]:= |

Out[16]= |

In[17]:= |

Out[18]= |

### Perturbed Kepler Problem

In[19]:= |

Out[22]= |

In[23]:= |

Out[23]= |

An experiment now illustrates the importance of using all the available invariants in the projective process (see [HLW02]). Consider the solutions obtained using:

In[24]:= |

Out[25]= |

In[26]:= |

Out[27]= |

In[28]:= |

Out[29]= |

In[30]:= |

Out[31]= |

It can be observed that only the solution with projection onto both invariants gives the correct qualitative behavior—for comparison, results using an efficient symplectic solver can be found in "SymplecticPartitionedRungeKutta Method for NDSolve".

### Lotka Volterra

An example of constraint projection for the Lotka–Volterra system is given within "Numerical Methods for Solving the Lotka–Volterra Equations".

### Euler's Equations

An example of constraint projection for Euler's equations is given within "Rigid Body Solvers".

## Option Summary

option name | default value | |

"Invariants" | None | specify the invariants of the differential system |

"IterationSafetyFactor" | specify the safety factor to use in the iterative solution of the invariants | |

MaxIterations | Automatic | specify the maximum number of iterations to use in the iterative solution of the invariants |

Method | "StiffnessSwitching" | specify the method to use for integrating the differential system numerically |