What is the simplest method to display all digits by adjusting this code?
t = Table[1 + 10^(-n), {n, 1, 10}] // TableForm
Output:
1.1
1.01
1.001
1.0001
1.00001
1.
1.
1.
1.
1.
What is the simplest method to display all digits by adjusting this code?
t = Table[1 + 10^(-n), {n, 1, 10}] // TableForm
Output:
1.1
1.01
1.001
1.0001
1.00001
1.
1.
1.
1.
1.
For the example problem, you know 1+10^(-n) will have exactly n digits after the decimal, or n+1 digits precision, so you can do:
Table[N[1 + 10^(-n), n + 1], {n, 1, 30}]
1.1 , 1.01 , 1.001 , .... 1.000000000000000000000000000001
The example in the comment is something like this:
h[t_] = 58 t - 83/100 t^2;
Table[With[{t = 1 + 10^(-n) },
N[ (h[ t] - h[1] )/(t - 1) , n + 4]], {n, 1, 15}] // MatrixForm

where the exact answer is N[ D[h[t], t] /. t -> 1 ] (* 56.34 *)
N[], exact input will always yield exact output (in this case, fractions). WithN[], atMachinePrecision, you can useInputForm[]to see digits; for other precision settings, you should see them in full. – J. M.'s missing motivation May 27 '15 at 21:08Table[N[1 + 10^(-n), n + 1], {n, 1, 30}]( a bit specialized to the specific example, but that's what you asked.. ) – george2079 May 27 '15 at 21:10