It is interesting to look at what happens when you try to “fit” the absolute value function using polynomials. Pick some number \(N\) of points on the absolute value function, and you can find a polynomial of degree \(N - 1\) that goes through those points.
Here is the absolute value function, \(f(x) = |x|\):
For simplicity, I’ll use an odd number of evenly spaced points so that the resulting polynomial will be even, since \(|x|\) is even.
Building on my last post, here is another way to construct a parabola using a collection of straight lines. First, the description, taken from Lockwood’s A Book of Curves (page 7):
Draw any two lines and mark on each a series of points at equal intervals. (The intervals on the second line need not be equal to those on the first.) Call the points on the first line \(A_1, A_2, A_3\), etc.
There are several ways to draw a parabola using straight lines. If you get a chance, you should try one sometime - it is always satisfying to see the outline of a curve slowly emerging from a collection of straight lines.
One method uses a set-square. As described in A Book of Curves by E.H. Lockwood (page 3):
Draw a fixed line \(AY\) and mark a fixed point \(S\). Place a set square \(UQV\) (right-angled at \(Q\)) with the vertex \(Q\) on \(AY\) and the side \(QU\) passing through \(S\) (Fig.
I started reading The Elements of Statistical Learning by Hastie, Tibshirani, and Friedman, and was curious about how to reproduce Figure 2.5. (The book is made available as a free and legal pdf here.)
So I figured out how to produce similar figures using Mathematica. I assume that this is also fairly straightforward to do in R, but I don’t yet know enough R.
The authors explain the sampling method on pages 16 and 17.