Option: number of digits

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?

=================

  

 

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.
– Oleksandr R.
Jan 13 ’15 at 12:11

=================

1 Answer
1

=================

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

?? Accuracy

?? SetPrecision

?? Precision

?? NumberForm

  

 

Thanks. I’ve learned a lot from your answer.
– David
Jan 12 ’15 at 14:49

  

 

May I ask “What is the difference between precision and accuracy?”
– David
Jan 12 ’15 at 14:56

  

 

@David, My Pleasure, see my Edit.
– Louis
Jan 12 ’15 at 15:10