1
$\begingroup$

I've tried:

In[169]:= newton3[x_] := N[1/2 (x + 3/x)];
FixedPointList[newton3, 1.0]

Out[170]= {1., 2., 1.75, 1.73214, 1.73205, 1.73205, 1.73205}

Of course:

In[164]:= N[Sqrt[3], 20]

Out[164]= 1.7320508075688772935

How do you use the FixedPointList to increase the number of decimal places?

$\endgroup$

2 Answers 2

6
$\begingroup$

The problem is not FixedPointList - the problem is that Mathematica by default doesn't display that many digits. Consider for example

FixedPoint[newton3, 1.0] // InputForm

which displays several more decimals. Another option is to increase PrintPrecision:

SetOptions[InputNotebook[], PrintPrecision -> 10]

This increases the number of decimals shown for all values in the current notebook.

Style[FixedPoint[newton3, 1.0], PrintPrecision -> 10]

does the same for the particular expression.

Finally we may do the following to make sure the problem isn't with FixedPoint:

FixedPoint[newton3, 1.0] == Sqrt[3]
(* True *)
$\endgroup$
0
$\begingroup$

You can also change the number of digits in the solution by setting smaller the criterion for convergence through SameTest, as in:

FixedPointList[(# + 3/# )/2 &, 1`20, SameTest -> (Abs[#1 - #2] < 1*^-10 &)]


{1.0000000000000000000, 2.0000000000000000000, 1.7500000000000000000, \
1.7321428571428571429, 1.7320508100147275405, 1.7320508075688772953, \
1.7320508075688772935}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.