A curious graph of f(1/n) from the Spivak's Calculus I am self-studying through Spivak's Calculus and on the fourth chapter, I got stuck at the plot of a function. It's on the page 61 by the way. The function is this and piecewisely defined;
 
$$f(1/n) = (-1)^{(n+1)}$$
$$f(-1/n) = (-1)^{(n+1)}$$ and
$f(x) = 1$ when $\mid{x}\mid\geq1$ 
So the interesting part is part of the graph between -1 and 1. Spivak says the function oscillates at each interval such as [1/n+1, 1/n] and each such interval behaves as a linear line segment. So when n = 3, we have f(1/3) = 1 and when n=2 we have f(1/2) = -1 and f behaves like a line in the interval [1/3, 1/2], going from -1 to 1. Spivak says we can even find a line equation for each such interval [1/n+1, 1/n]. But I can't see how this graph is made of straight lines. Can anyone explain this to me?

The author is constructing a piecewise function from a set of points; so what he did was to plot $y$-values of $1$ at the points $x=1,\frac{1}{3},\frac{1}{5} ... $, and $-1$ at $x = \frac{1}{2},\frac{1}{4},\frac{1}{6}...$.
He then joins these points together, and the lines that join them together are linear functions defined differently on each interval $[1/(n+1), 1/n]$, i.e. 'piecewise'.
The exact expression of each piecewise function is not given, but it's easy to find. If I'm not mistaken, the entire point of the illustration is to introduce the concept of piecewise-defined functions.
(For completeness, the formula in the case of $x>0$ should be $f(x) =-1+2\frac{\left(x-\frac{1}{n+1}\right)}{\left(\frac{1}{n}-\frac{1}{n+1}\right)}=-1+2n(n+1)\left(x-\frac{1}{n+1}\right)$ in $[1/(n+1), 1/n]$ when $n$ is odd, and something similar when n is even.)
