2
$\begingroup$

The command

NestList[Cos, 1.5, 10]

produces the list:

{0.750313, 0.731476, 0.74419, 0.735637, 0.741403, 0.737522,
 0.740137, 0.738376, 0.739563, 0.738763, 0.739302}

What is an easy way to have each number in the list have 10 significant digits?

$\endgroup$
  • $\begingroup$ They already have 16 significant digits; they are just not all printed. Try InputForm, or otherwise change the print precision in Preferences. I wouldn't recommend jumping to arbitrary precision numbers without a good reason, nor reassigning precision using SetPrecision without a very good understanding of what it does. $\endgroup$ – Oleksandr R. Jan 13 '15 at 12:11
5
$\begingroup$

Try the following,

N[NestList[Cos, 15/10, 10], 10]

{*
{1.500000000,0.07073720167,0.9974991672,0.5424049923,0.8564697089,0.6551088018,
0.7929816458,0.7017241683,0.7637303113,0.7222610821,0.7503128857}
*}

SetAccuracy[NestList[Cos, 1.5, 10], 10];
SetPrecision[NestList[Cos, 1.5, 10], 10];


NumberForm[NestList[Cos, 1.5, 10], {10, 10}]

{*
{1.5000000000,0.0707372017,0.9974991672,0.5424049923,0.8564697089,
0.6551088018,0.7929816458,0.7017241683,0.7637303113,0.7222610821,0.7503128857}
*}

Edit
With F1 or ?? you can find more information:

?? SetAccuracy

enter image description here

?? Accuracy

enter image description here

?? SetPrecision

enter image description here

?? Precision

enter image description here

?? NumberForm

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks. I've learned a lot from your answer. $\endgroup$ – David Jan 12 '15 at 14:49
  • $\begingroup$ May I ask "What is the difference between precision and accuracy?" $\endgroup$ – David Jan 12 '15 at 14:56
  • $\begingroup$ @David, My Pleasure, see my Edit. $\endgroup$ – user9660 Jan 12 '15 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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