WOLFRAM LANGUAGE TUTORIAL

# "LocallyExact" Method for NDSolve

## Introduction

A differential system can sometimes be solved by analytic means. The function DSolve implements many of the known algorithmic techniques.

However, differential systems that can be solved in closed form constitute only a small subset. Despite this fact, when a closed-form solution does not exist for the entire vector field, it is often possible to analytically solve a system of differential equations for part of the vector field. An example of this is the method , which breaks up a vector field into subfields such that .

The idea underlying the method is that rather than using a standard numerical integration scheme, when a solution can be found by DSolve direct numerical evaluation can be used to locally advance the solution.

Since the method makes no attempt to adaptively adjust step sizes, it is primarily intended for use as a submethod between integration steps.

## Examples

Load a package with some predefined problems.

### Harmonic Oscillator

Numerically solve the equations of motion for a harmonic oscillator using the method

. The result is two interpolating functions that approximate the solution and the first derivative.

Out[5]= | |

The solution evolves on the unit circle.

Out[6]= | |

### Global versus Local

The method is not intended as a substitute for a closed-form (global) solution.

Despite the fact that the method uses the analytic solution to advance the solution, it only produces solutions at the grid points in the numerical integration (or even inside grid points if called appropriately). Therefore, there can be errors due to sampling at interpolation points that do not lie exactly on the numerical integration grid.

Plot the error in the first solution component of the harmonic oscillator and compare it with the exact flow.

Out[7]= | |

### Simplification

The method has an option that can be used to simplify the results of DSolve.

Here is the linearized component of the differential system that turns up in the splitting of the Lorenz equations using standard values for the parameters.

This subsystem is exactly solvable by

DSolve.

Out[11]= | |

Often the results of

DSolve can be simplified. This defines a function to simplify an expression and also prints out the input and the result.

The function can be passed as an option to the method

.

Out[13]= | |

The simplification is performed only once during the initialization phase that constructs the data object for the numerical integration method.

## Option Summary

| | |

"SimplificationFunction" | None | function to use in simplifying the result of DSolve |

Option of the method .