# WorkingPrecision

is an option for various numerical operations that specifies how many digits of precision should be maintained in internal computations.

# Details • WorkingPrecision is an option for such functions as NIntegrate and FindRoot.
• Setting causes all internal computations to be done to at most ndigit precision.
• Setting causes all internal computations to be done with machine numbers.
• Even if internal computations are done to ndigit precision, the final results you get may have much lower precision.

# Examples

open allclose all

## Basic Examples(2)

Find a root using 60-digit precision arithmetic:

Solve a differential equation using 24-digit precision arithmetic:

## Scope(4)

Evaluate the function using 24-digit precision arithmetic:

Without higher precision you see mainly numerical roundoff error:

Approximate an integral using 24-digit precision arithmetic:

The PrecisionGoal is automatically increased to be 10 less than the working precision:

Find a minimum of a function, adaptively increasing the precision up to 50 digits:

The PrecisionGoal and AccuracyGoal are automatically set to be half the final precision:

Solve a differential equation with 32-digit precision arithmetic:

The PrecisionGoal and AccuracyGoal are set to be half of the working precision:

Using will reduce the errors between steps:

## Applications(1)

Check the quality of a solution to Duffing's equation by using a sequence of solution precisions:

Make a sequence of solutions at successively higher working precision:

A plot shows that some of the solutions deviate toward the end:

Plot the solution x as a function of working precision:

Convergence to the solution at the highest precision indicates about 6 digits can be trusted:

## Possible Issues(2)

Low-precision parameters in functions may invalidate the use of higher-precision arithmetic: The result is a poor approximation to :

Use of exact parameters allows comparison at different precisions:

Expect solution times to increase exponentially as a function of working precision:

A log plot of the computation time as a function of working precision: