I use FindRoot
to find a root to the equation
eq = -1 + c x^2 + (
b^2 (1 + 2 d + e - 3 (d + e) x + 3 e x^2 + (-1 + d - e) x^3))/(
3 (1 + a) x);
where a
, ..., e
are constants, e.g.
{a, b, c, d, e} = {1000, 1000, 0.6, -10723, 10^12};
I want the answer to a specific precision, let's say 25 digits. But when I compare the following two solutions, where I use two different working precision,
FindRoot[SetPrecision[eq, 25], {x, 1/2}, PrecisionGoal -> 25,
WorkingPrecision -> 25]
FindRoot[SetPrecision[eq, 50], {x, 1/2}, PrecisionGoal -> 25,
WorkingPrecision -> 50]
I get x->0.9999894532286245466222468
when working with 25 digits and x->0.99998945322862454662225125766796125178624086444648
when working with 50 digits. What surprises me is that they should agree to the first 25 digits, but they don't (cf. digits 23-25). Yet, Mathematica leaves no error message, despite it seems that it didn't succeed in solving the equation to the required precision. Why?
PrecisionGoal
: "Even though you may specify PrecisionGoal->n, the results you get may sometimes have much less than n-digit precision." and "In most cases, you must set WorkingPrecision to be at least as large as PrecisionGoal.". In general, I would recommend against using aWorkingPrecision
equal to thePrecisionGoal
. Always have extraWorkingPrecision
to spare. $\endgroup$ – Sjoerd Smit Oct 27 '20 at 9:51