Chapter 2: Answers 2 Jack K. Cohen Colorado School of Mines
f[x_] := x^3 + 3x^2 f[2] 20 f[x] /. x -> 2 20 f[t] 2 3 3 t + t f[cat] 2 3 3 cat + cat Table[f[n], {n, 1, 5}] {4, 20, 54, 112, 200} Plot[f[x], {x, -2, 2}] See Figure 1.
Plot[(Sqrt[x + 25] - 5)/x, {x, -2, 2}, PlotRange -> {0, .5}]
Table[{x, (Sqrt[x + 25] - 5)/x}, {x, -1/5, 1/5, 1/20}] //N //TableForm
-0.2 0.100201 -0.15 0.10015 -0.1 0.1001 -0.05 0.10005 0 Indeterminate 0.05 0.09995 0.1 0.0999002 0.15 0.0998504 0.2 0.0998008It may seem more natural to ``force'' to use decimal arithmetic during the calculation instead of evoking N afterwards, perhaps like this:
Table[{x, (Sqrt[x + 25] - 5)/x}, {x, -.2, .2, .05}] //TableForm.
However, with in-exact arithmetic, the user has to be alert enough to reject output that is too close to the singular point:
-0.2 0.100201 -0.15 0.10015 -0.1 0.1001 -0.05 0.10005 -17 -1.38778 10 0. 0.05 0.09995 0.1 0.0999002 0.15 0.0998504 0.2 0.0998008
0.1 0.0999002 0.01 0.09999 0.001 0.099999 0.0001 0.0999999 0.00001 0.1With x -> a - 1/10ˆk, we get:
-0.1 0.1001 -0.01 0.10001 -0.001 0.100001 -0.0001 0.1 -0.00001 0.1
Note: We have supplied a function called LimitTable that uses this code as its core.