WorkingPrecision

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 WorkingPrecision->n causes all internal computations to be done to at most ndigit precision.
  • Setting WorkingPrecision->MachinePrecision 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 InterpolationOrder->All 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[100] 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:

Wolfram Research (1988), WorkingPrecision, Wolfram Language function, https://reference.wolfram.com/language/ref/WorkingPrecision.html (updated 2003).

Text

Wolfram Research (1988), WorkingPrecision, Wolfram Language function, https://reference.wolfram.com/language/ref/WorkingPrecision.html (updated 2003).

CMS

Wolfram Language. 1988. "WorkingPrecision." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/WorkingPrecision.html.

APA

Wolfram Language. (1988). WorkingPrecision. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WorkingPrecision.html

BibTeX

@misc{reference.wolfram_2024_workingprecision, author="Wolfram Research", title="{WorkingPrecision}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/WorkingPrecision.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_workingprecision, organization={Wolfram Research}, title={WorkingPrecision}, year={2003}, url={https://reference.wolfram.com/language/ref/WorkingPrecision.html}, note=[Accessed: 18-November-2024 ]}