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?

Take a look at the book again, he said two things: "The graph in figure 18 is made up entirely of straight lines" and "The function $f$ with this graph satisfies [formulas] and is a linear function on each interval [intervals]." 
He says that the function in figure $18$ satisfies those formulas, not that these formulas are the function pictured in figure $18$. With the formulas in that page, you can only do - assuming a function $\Bbb{N}\to \Bbb{R}$. If you take $\Bbb{R}\to\Bbb{R}$ or $\Bbb{Q}\to\Bbb{R}$  - some values will have their images in $\Bbb{C}$.



The function in the next page is as follows. 



And then he says that we can build explicit formulas for the intervals of those points, that is: We can fill the spaces just as the previous graph and extend the domain to $\Bbb{R}$. A very important idea is to be able to manipulate/construct functions with operations like gluing/distorting/etc any other kinds of known functions. As an example: One remarkable idea is that you can approximate functions such as $\sin(x)$ by polynomials. 
Another really interesting example is the gamma function. If you take $f(n)=n!$, this is only defined for $n \in \Bbb{N}$. What if you want to fill the spaces between the points? One answer is the gamma function, another possible answer is the Stirling approximation for factorials:



