User:Mrrmv

Wikiversity additions proposal
I propose to add to the Interpolation section of the Topic: Numerical Analysis article in Wikiversity. I plan to provide links to all relevant Wikipedia articles on the topic of polynomial interpolation, including but not limited to those on Lagrange interpolation, the Vandermonde matrix, and Newton interpolation. I also plan to search out and add some other relevant links outside of Wikipedia. Furthermore, I will provide an exercise/example for each of the three main types of interpolation. Finally, I plan to write and publish a quiz covering the overall topic. The quiz and the exercises will illustrate the various advantages and disadvantages of each interpolation method.

If another student decides to do the same topic, I can either split the topic with him, or choose another one, my second choice being root-finding methods, and my third choice being numerical differential equations.

List of polynomial interpolation additions
The following is a list of the actual additions I made to the interpolation section. All changes pertain to polynomial interpolation.


 * Links to Wikipedia pages on polynomial interpolation, the Vandermonde matrix, Lagrange interpolation, the Newton form, divided differences, Neville's algorithm, and a comparison of the three methods.
 * An example of polynomial interpolation using the Vandermonde matrix, and then an example of the process of interpolating a new polynomial after a point has been added to the data set.
 * An example using the same points as above, but this time interpolating with the Lagrange method.
 * An example using the same points as above, but this time interpolating in the Newton form.
 * An exercise for each of the three methods, each time using a new set of points.
 * A concept quiz that covers uniqueness of the interpolating polynomial and comparisons of the methods pertaining to: ease of use, computational cost, and the best choice of method for some situations.

Project report
As a graduate student in Math 544 at Ohio University, my final project required me to contribute to the Topic: Numerical analysis page on Wikiversity. I chose to add to the section on interpolation. Specifically, I decided to contribrute examples, exercises, a quiz, and links pertaining to polynomial interpolation.

Before beginning the final project, I completed several class assignments, some of which involved programming, and some of which involved editing and improving a Wikipedia page. I had chosen to complete my programming assignments in Python, that being the language I am most familiar with. Thus, when the assignment to improve a Wikipedia page came about, I found an opportunity to improve a sample Python code on the page about the Horner Scheme. Specifically, the Python code had no comments and no description. Furthermore, it took an extra, unnecessary input, and had a variable that was redundant, and therefore not necessary. I made the code changes, added a description to the program, and posted my improvements and proposal on the discussion page. I got no responses to my proposal from the community. After I turned in a printout of my post, my instructor stated his approval of my change, so I made the edit to the Wikipedia page. It still stands today.

Towards the end of the quarter, I had to choose my topic for the final project and write a brief proposal on what additions I planned to make to the Wikiversity page. Choosing a topic that needed improvement was simple, because all topics on the page were blank except for one. Thus, my topic choice came down to a matter of personal preference. I had never found differential equations to be one of my strengths, and numerical integration can get a bit too hairy sometimes (especially when I'm typing it out). Thus, I chose to contribute to the interpolation section. What we had covered in class was polynomial interpolation, so I limited myself to that.

When deciding exactly what to add to the interpolation section, I kept in mind the purpose of Wikiversity (as opposed to Wikipedia), and followed the example set forth by the instructor in the numerical linear algebra section of the page. That section had links, examples, exercises, and a quiz. So, my proposal was to add links, examples, exercises, and a quiz. Specifically, I'd decided to focus on the three methods of polynomial interpolation that we'd covered in class: the Vandermonde matrix method, the Lagrange method, and the Newton form. My proposal was to provide relevant links to information about each method and polynomial interpolation as a whole, compose and write an exercise or two for each method, and also to write and post an overall concept quiz.

My actual contributions more or less followed the initial proposal. First, I provided Wikipedia links to the pages I felt relevant to the topic. These included a link to the article on polynomial interpolation in general, the Vandermonde matrix subsection of that page, the Lagrange method, the Newton form, divided differences (relevant to the Newton form), Neville's algorithm (relevant to divided differences as well as polynomial interpolation), and a link to the comparison of the three methods that is located in the Newton form article.

Before adding any exercises, I decided it would be good to add an example problem for each method. Each example provides a set of points, and then demonstrates step-by-step the implementation of its respective method in finding the interpolating polynomial for the given points. Furthermore, each example for each method uses the same points, and thus gives the same interpolating polynomial. This demonstrates the uniqueness of the interpolating polynomial for a given set of points. Finally, after finding the interpolating polynomial, each example features a section about adding an additional point to the data set, and finding a new interpolating polynomial with the expanded data. Therefore, the user can gain further insight on the ease-of-use, or lack thereof, of each particular method.

I also added an exercise for each method. Unlike the examples, the exercises do not show every step of each process. They only provide the solution and the setup to their respective methods. The reason I provided some method-specific setup as part of each solution was because, due to the uniqueness of the interpolating polynomial, a student could be asked to use the Newton form, but still find the right answer using the Lagrange method. Thus, I provided a way for them to check that they are using the proper method correctly, thus encouraging and helping each student to properly use the stated method to find the correct answer.

My final addition was a short concept quiz to tie everything together. It covers ease-of-use and situational applications of the methods as well as computational cost and failure. It also touches on the uniqueness of the interpolating polynomial through a set of points. The concept quiz is intended to be completed by the student only after he has visited and studied the various links, read the examples, and completed the exercises. The examples are especially important, as I designed them with a general outline for the concept quiz in mind. Thus, a student who has studied the examples should, through his own insight, be able to correctly answer about three quarters of the quiz.

In summary, I have expanded upon the interpolation section of the numerical methods page. In the spirit of Wikiversity, I have provided links, original examples and exercises, and an original concept quiz in order to help a student learn and understand the concept of polynomial interpolation, specifically using the Lagrange method, Vandermonde matrix, and Newton form.

Lagrange example
We'll find the interpolating polynomial passing through the points $$ (1,-6)$$, $$(2,2)$$, $$(4,12)$$, using the Lagrange method.

We first use the formula to write the following:

$$ p(x) = -6\frac{(x-2)}{(1-2)}\frac{(x-4)}{(1-4)} + 2\frac{(x-1)}{(2-1)}\frac{(x-4)}{(2-4)} + 12\frac{(x-1)}{(4-1)}\frac{(x-2)}{(4-2)}$$

After some simplification, we get:

$$ p(x) = -2(x-2)(x-4) - 1(x-1)(x-4) + 2(x-1)(x-2)$$

$$ p(x) = -2(x^{2} -6x +8) -1(x^{2} -5x +4) +2(x^{2}-3x +2)$$

And our answer:

$$ p(x) = -x^{2} +11x -16$$

Adding a point
Now we'll add a point to our data set, and find a new interpolating polynomial. Let us add the point $$(3,-10)$$ to our set. Starting over with the Lagrange formula, we write:

$$ p(x) = -6\frac{(x-2)}{(1-2)}\frac{(x-4)}{(1-4)}\frac{(x-3)}{(1-3)} + 2\frac{(x-1)}{(2-1)}\frac{(x-4)}{(2-4)}\frac{(x-3)}{(2-3)} + 12\frac{(x-1)}{(4-1)}\frac{(x-2)}{(4-2)}\frac{(x-3)}{(4-3)} - 10\frac{(x-1)}{(3-1)}\frac{(x-2)}{(3-2)}\frac{(x-4)}{(3-4)}$$

Simplifying, we get:

$$ p(x) = (x-2)(x-4)(x-3) + (x-1)(x-4)(x-3) +2(x-1)(x-2)(x-3) + 5(x-1)(x-2)(x-4) $$

$$ p(x) = (x^{3} - 9x^{2} + 26x -24) + (x^{3} - 8x^{2} + 19x -12) + 2(x^{3} -6x^{2} + 11x -6) + 5(x^{3} -7x^{2} +14x -8)$$

And our polynomial is:

$$ p(x) = 9x^{3} -64x^{2} + 137x -88 $$

Lagrange exercise
Find the interpolating polynomial passing through the points $$ (1,2)$$, $$(3,4)$$, $$(5,6)$$, $$(7,8)$$, using the Lagrange method. Solution: $$ p(x) = 2\frac{(x-3)}{(1-3)}\frac{(x-5)}{(1-5)}\frac{(x-7)}{(1-7)} +4\frac{(x-1)}{(3-1)}\frac{(x-5)}{(3-5)}\frac{(x-7)}{(3-7)} +6\frac{(x-1)}{(5-1)}\frac{(x-3)}{(5-3)}\frac{(x-7)}{(5-7)} + 8\frac{(x-1)}{(7-1)}\frac{(x-3)}{(7-3)}\frac{(x-5)}{(7-5)}$$

$$p(x) = \frac{5}{12}x^{3} - \frac{65}{12}x^{2} + \frac{247}{12}x - \frac{163}{12} $$

Vandermonde example
We'll find the interpolating polynomial passing through the points $$ (1,-6)$$, $$(2,2)$$, $$(4,12)$$, using the Vandermonde matrix.

For our polynomial, we'll take $$(1,-6) = (x_{0},y_{0})$$, $$(2,2) = (x_{1},y_{1})$$, and $$ (4,12) = (x_{2},y_{2})$$.

Define our interpolating polynomial as:

$$p(x) = a_{2}x^{2} + a_{1}x + a_{0}$$.

So, to find the coefficients of our polynomial, we solve the system $$ p(x_{i}) = y_{i}$$, $$i\in \{0,1,2\}$$.

In order to solve the system, we will use an augmented matrix based on the Vandermonde matrix, and solve for the coefficients using Gaussian elimination. Substituting in our $$x$$ and $$y$$ values, our augmented matrix is:

$$ \left( \begin{array}{cccc} 1 & 1 & 1 & -6 \\ 4 & 2 & 1 & 2 \\ 16 & 4 & 1 & 12 \end{array} \right) $$

Then, using Gaussian elimination,

$$ \left( \begin{array}{cccc} 1 & 1 & 1 & -6 \\ 4 & 2 & 1 & 2 \\ 16 & 4 & 1 & 12 \end{array} \right) \rightarrow \left( \begin{array}{cccc} 1 & 1 & 1 & -6 \\ 0 & -2 & -3 & 26 \\ 0 & -12 & -15 & 108 \end{array} \right) \rightarrow \left( \begin{array}{cccc} 1 & 1 & 1 & -6 \\ 0 & -2 & -3 & 26 \\ 0 & 0 & 3 & -48 \end{array} \right) \rightarrow \left( \begin{array}{cccc} 1 & 1 & 0 & 10 \\ 0 & 2 & 0 & -22 \\ 0 & 0 & 1 & -16 \end{array} \right) \rightarrow \left( \begin{array}{cccc} 1 & 0 & 0 & -1 \\ 0 & 1 & 0 & 11 \\ 0 & 0 & 1 & -16 \end{array} \right) $$

Our coefficients are $$ a_{2} = -1$$, $$ a_{1} = 11$$, and $$ a_{0} = -16$$. So, the interpolating polynomial is

$$ p(x) = -x^{2} +11x -16 $$.

Adding a point
Now we add a point, $$(3,-10) = (x_{3},y_{3})$$, to our data set and find a new interpolation polynomial with this method. Our polynomial is $$p(x) = a_{3}x^{3} + a_{2}x^{2} + a_{1}x + a_{0}$$, and we get the coefficients by solving the system $$p(x_{i}) = y_{i}$$. Constructing our augmented matrix as before and using Gaussian elimination, we get:

$$ \left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & -6 \\ 8 & 4 & 2 & 1 & 2 \\ 64 & 16 & 4 & 1 & 12 \\ 27 & 9 & 3 & 1 & -10 \end{array} \right) \rightarrow \left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & -6 \\ 0 & -4 & -6 & -7 & 50 \\ 0 & -48 & -60 & -63 & 396 \\ 0 & -18 & -24 & -26 & 152 \end{array} \right) \rightarrow \left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & -6 \\ 0 & -4 & -6 & -7 & 50 \\ 0 & 0 & 12 & 21 & -204 \\ 0 & 0 & 3 & \frac{11}{12} & -73 \end{array} \right) $$

$$\rightarrow \left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & -6 \\ 0 & -4 & -6 & -7 & 50 \\ 0 & 0 & 12 & 21 & -204 \\ 0 & 0 & 0 & \frac{1}{4} & -22 \end{array} \right) \rightarrow \left( \begin{array}{ccccc} 1 & 1 & 1 & 0 & 82 \\ 0 & -4 & -6 & 0 & -566 \\ 0 & 0 & 12 & 0 & 1644 \\ 0 & 0 & 0 & 1 & -88 \end{array} \right) \rightarrow \left( \begin{array}{ccccc} 1 & 1 & 0 & 0 & -55 \\ 0 & -4 & 0 & 0 & 256 \\ 0 & 0 & 1 & 0 & 137 \\ 0 & 0 & 0 & 1 & -88 \end{array} \right) $$

$$\rightarrow \left( \begin{array}{ccccc} 1 & 0 & 0 & 0 & 9 \\ 0 & 1 & 0 & 0 & -64 \\ 0 & 0 & 1 & 0 & 137 \\ 0 & 0 & 0 & 1 & -88 \end{array} \right) $$

Therefore, our polynomial is:

$$p(x) = 9x^{3} -64x^{2} + 137x -88 $$.

Vandermonde exercise
Using a Vandermonde matrix, find the interpolating polynomial that passes through the points $$(1,9)$$, $$(2,9)$$, $$(3,6)$$, $$(7,3)$$. Give both the polynomial, and the augmented matrix you used. Solution: The augmented matrix depends on your choice of index for the given points. One possibility is:

$$ \left( \begin{array}{ccccc} 1 & 1 & 1 & 1 & 9 \\ 8 & 4 & 2 & 1 & 9 \\ 27 & 9 & 3 & 1 & 6 \\ 343 & 49 & 7 & 1 & 3 \end{array} \right) $$

The polynomial is:

$$ p(x) = \frac{13}{40}x^{3} - \frac{69}{20}x^{2} + \frac{323}{40}x + \frac{81}{20}$$.

Newton form example
We'll find the interpolating polynomial passing through the points $$ (1,-6) = (x_{0},y_{0})$$, $$(2,2) = (x_{1},y_{1})$$, $$(4,12) = (x_{2},y_{2})$$, using the Newton form of the interpolation polynomial.

The Newton form is given by the formula $$ p(x) = \sum_{j=0}^{k}a_{j}n_{j}(x)$$, where $$ a_{j} = [y_{0},\ldots,y_{j}]$$ and $$ n_{j}(x) = \prod_{i = 0}^{j-1}(x-x_{i})$$, with $$n_{0}(x) = 1$$. We start by finding each $$n_{j}(x)$$.

$$n_{0}(x) = 1$$

$$n_{1}(x) = x-1$$

$$n_{2}(x) = (x-1)(x-2) = x^{2} -3x +2$$

Next, we find the necessary divided differences. First, $$[y_{0}] = -6$$, $$[y_{1}] = 2$$, and $$[y_{2}] = 12$$. For the next level, we have:

$$[y_{0},y_{1}] = \frac{2+6}{2-1} = 8$$

$$[y_{1},y_{2}] = \frac{12-2}{4-2} = 5$$

Finally, we can find:

$$[y_{0},y_{1},y_{2}] = \frac{5-8}{4-1} = -1$$.

Now, we can find the coefficients $$a_j$$.

$$a_{0} = [y_{0}] = -6$$

$$a_{1} = [y_{0},y_{1}] = 8$$

$$a_{2} = [y_{0},y_{1},y_{2}] = -1$$

Substituting and simplifying, we get our interpolating polynomial:

$$p(x) = -6 +8(x-1) - (x^{2} -3x +2) = -x^{2} + 11x -16$$.

Adding a point
Now let's add the point $$(3,-10) = (x_{3},y_{3})$$ to our data set and find the new polynomial using the same method. Due to the formula for the Newton form, we only have to add the term $$ a_{3}n_{3}(x)$$ to our previous interpolating polynomial.

First, we have

$$n_{3}(x) = (x-1)(x-2)(x-4) = x^{3} - 7x^{2} +14x -8$$.

Now to find $$a_{3}$$ we calculate some more divided differences.

$$[y_{3}] = -10$$

$$[y_{2},y_{3}] = \frac{-10-12}{3-4} = 22$$

$$[y_{1},y_{2},y_{3}] = \frac{22-5}{3-2} = 17$$

$$a_{3} = [y_{0},\ldots,y_{3}] = \frac{17+1}{3-1} = 9$$

So, our new interpolating polynomial is:

$$p(x) = -x^{2} + 11x -16 + 9(x^{3}-7x^{2}+14x-8) = 9x^{3}-64x^{2}+137x-88$$.

Newton form exercise
Using the Newton form, find the interpolating polynomial passing through the points $$(x_{0},y_{0}) = (9,9)$$, $$(x_{1},y_{1}) = (5,7)$$, $$(x_{2},y_{2}) = (3,7)$$, and $$(x_{3},y_{3}) = (7,1)$$. Also give the four coefficients $$a_{j}$$ from the formula for the Newton polynomial.

Solution: The four coefficients are:

$$a_{0} = 9$$

$$a_{1} = \frac{1}{2}$$

$$a_{2} = \frac{1}{12}$$

$$a_{3} = \frac{5}{12}$$.

The polynomial is:

$$p(x) = \frac{5}{12}x^{3} - 7x^{2} + \frac{427}{12}x -48$$.

Polynomial interpolation concept quiz
Choose the best answer for each question:

{Of the following polynomial interpolation methods, which is generally considered the method of choice due to its relative ease of use?} - Vandermonde matrix + Lagrange method - Newton form

{Which method is the best choice when the desired degree of the interpolating polynomial is known?} - Vandermonde matrix + Lagrange method - Newton form

{Which method is best suited when the desired degree of the interpolating polynomial is unknown?} - Vandermonde matrix - Lagrange method + Newton form

{Which method is best suited to the addition of points to the data set?} - Vandermonde matrix - Lagrange method + Newton form

{What is the computational cost of finding an interpolating polynomial through $$n$$ points using the Newton form?} - $$O(n)$$ + $$O(n^{2})$$ - $$O(n^{3})$$ - $$O(n^{4})$$

{What is the computational cost of the Vandermonde method, using Gaussian elimination?} - $$O(n)$$ - $$O(n^{2})$$ + $$O(n^{3})$$ - $$O(n^{4})$$

{Under what conditions can the Lagrange method of polynomial interpolation fail?} - When $$n > 10$$. - When $$n$$ is not a perfect square. - When two or more of your $$y$$-values are equal. + The Lagrange method cannot fail.

{Given a set of $$n$$ points, exactly how many interpolating polynomials can be found to pass through the points?} - $$0$$ + $$1$$ - $$n$$ - $$n-1$$