- #1

StoneTemplePython

Science Advisor

Gold Member

- 1,203

- 596

The other question I have is about deriving a polynomial to approximate a function. The example given is the function sin((pi * x^2)/ 2). The textbook says you can't integrate that (I don't remember that much calculus), so it shows finding a polynomial that approximates it and integrating that instead.

The text shows finding: f(0)=0, f(.25)=.098017, f(.5)=.382683, f(.75)=.77301, f(1)=1

Then it somehow uses linear algebra (matrices representing a system of equations or something?) to find the approximating polynomial p(x)=.098796x + .762356x^2 + 2.14429x^3 - 2.00544x^4

Could someone show how to do this?

your second question seems like an excellent introduction to Vandermonde Matrices. I wouldn't recommend solving this 5x5 matrix by hand. With some cleverness you can get it down to a 4x4 matrix but still a lot of work to do by hand. A good computer exercise. It would be worth learning to derive the determinant formula for Vandermonde Matrix though.

(You can see its effect in your first question but sketching the equation and solving it the 'regular way' seems preferable for intuition I think.)

The big idea is that a degree ##n## single variable polynomial (that isn't identically zero) is completely specified by ##n+1## distinct data points.