0

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.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
David
  • 14,883
  • 4
  • 44
  • 117
  • 1
    Without N[], exact input will always yield exact output (in this case, fractions). With N[], at MachinePrecision, you can use InputForm[] to see digits; for other precision settings, you should see them in full. – J. M.'s missing motivation May 27 '15 at 21:08
  • 3
    Table[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
  • Possibly related or duplicate: (3736) – Mr.Wizard May 27 '15 at 21:19
  • 2
    @Mr.Wizard: George's answer is perfect as I want to produce a table showing $\lim\limits_{t\to1}\frac{h(t)-h(1)}{t-1}=56.34$ for students being introduced to finding the derivative of $h(t)=58t-0.83t^2$ for the first time. By the way, thanks for your comment on disabling the Suggestions bar. – David May 27 '15 at 21:28
  • 1
    @george2079 I am reopening this; please post that as an answer. – Mr.Wizard May 27 '15 at 21:31

1 Answers1

3

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

enter image description here

where the exact answer is N[ D[h[t], t] /. t -> 1 ] (* 56.34 *)

george2079
  • 38,913
  • 1
  • 43
  • 110