is an option for various numerical operations that specifies how many digits of precision should be maintained in internal computations.
- WorkingPrecision is an option for such functions as NIntegrate and FindRoot.
- Setting WorkingPrecision->n causes all internal computations to be done to at most n‐digit precision.
- Setting WorkingPrecision->MachinePrecision causes all internal computations to be done with machine numbers.
- Even if internal computations are done to n‐digit precision, the final results you get may have much lower precision.
Examplesopen allclose all
Basic Examples (2)
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:
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:
Wolfram Research (1988), WorkingPrecision, Wolfram Language function, https://reference.wolfram.com/language/ref/WorkingPrecision.html (updated 2003).
Wolfram Language. 1988. "WorkingPrecision." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/WorkingPrecision.html.
Wolfram Language. (1988). WorkingPrecision. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WorkingPrecision.html