Here is a short demo. Generate the Dottie number as an exact Root[]
object, like so:
dottie = x /. First @ Solve[x == Cos[x] && 0 < x < 1, x];
(Tho you might notice an inexact number in the output, rest assured that the resulting Root[]
object is an exact number that can be evaluated to arbitrary precision; the number is there only as a sort of "localization marker".)
Use FindRoot[]
to generate an approximation of the Dottie number:
ndottie = x /. FindRoot[Cos[x] - x, {x, 1}, AccuracyGoal -> 5, PrecisionGoal -> 5,
WorkingPrecision -> 30];
Altho Precision[ndottie] == 30.
, the result is not actually accurate to all 30 digits. Here is the relative error:
-Log10[Abs[1 - ndottie/dottie]]
20.0631570441
which says that the result is accurate to about 20 digits, even with the supposedly low settings. Now, crank up the settings:
ndottie2 = x /. FindRoot[Cos[x] - x, {x, 1}, AccuracyGoal -> 15,
PrecisionGoal -> 15, WorkingPrecision -> 30];
and you'll find that ndottie2 - dottie
is effectively zero.
FindRoot
will use 100 digits inx
in each step of the iteration towards the root, and when it has found the root to 15 digit precision, it stops, and return thatx
, which still has a precision of 100. $\endgroup$