# Variable Increments in a Table

I am working on a problem involving the piecewise function:

$$x^2 \quad \mbox{if } \quad x < 2$$

$$(x-3)/(\sqrt{x-2}-1) \quad \mbox{if } \quad x \geq 2$$

I am supposed to find the values of the limits as $x$ approaches $2$ from the right and the left. I've found these values to be $1$ from the right and $4$ from the left.

However, the question I'm struggling to answer involves the formatting of a limit table.

I've been able to make two tables of (x,f[x]) from the left and the right, and I've listed specific values of $x$ to approach $2$ with. However, the question wants me to make a $4$ column table using only one table command, and to use a rule to make the step size increments progressively smaller. I'm not sure how to do this.

Here's the text of the question: "To evaluate a two sided limit, create a single table (generated by a single table command) with four columns, combining the left-and right-sided limit tables into one. Values of $x$ should approach the limiting value moving down the table. To evaluate a limit, create table(s) that use step-size increments that are progressively smaller as the limiting value is approached (eg. x=3, 2.1, 2.01, 2.001,... for a limit as x→ 2+). Rather than listing every $x$-value, use a rule to generate the $x$-values."

Here is how I've made my tables thus far:

TableForm[Table[{x, f[x]}, {x, {4, 3, 2.5, 2.5, 2.25, 2.1, 2.05, 2.02,2.001}}]]
TableForm[Table[{x, f[x]}, {x, {-1, 0, 1, 1.5, 1.75, 1.9, 1.95, 1.97, 1.98, 1.999}}]]

• Is this homework? If so, please tag it as such.
– ciao
Feb 9, 2017 at 8:21

One possible way to use Accumulate to generate the steps.

N@Table[i, {i, Accumulate[Table[1/(2^t), {t, 1, 10}]]}]


Then you can these values for building the steps, by adding and subtracting the above from 2 for each side.

ClearAll[f, i, t, x];

f[x_] := Piecewise[{{x^2, x < 2}, {(x - 3)/(Sqrt[x - 2] - 1), x >= 2}}]

r = Table[{x = 1 + i; x, f[x], x = 3 - i; x, f[x]},
{i,Accumulate[Table[1/(2^t), {t, 1, 10}]]}];

h = {"x", "limit from left", "x", "limit from right"};
Grid[Join[{h}, N@r], Alignment -> Left, Frame -> All]


Plot[f[x], {x, -1, 3}, Frame -> True, GridLines -> Automatic,
GridLinesStyle -> LightGray]