12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

178 chapter 8Lagrange interpolation to determine a third-order polynomial that reproduces thevalues x 1−4 =(0, 1, 2, 4), f 1−4 =(−12, −12, −24, −60):g(x)=(x − 1)(x − 2)(x − 4) x(x − 2)(x − 4)(−12) +(0 − 1)(0 − 2)(0 − 4) (1 − 0)(1 − 2)(1 − 4) (−12)+x(x − 1)(x − 4)x(x − 1)(x − 2)(−24) +(2 − 0)(2 − 1)(2 − 4) (4 − 0)(4 − 1)(4 − 2) (−60),⇒ g(x)=x 3 − 9x 2 +8x − 12. (8.35)As a check we see thatg(4)=4 3 − 9(4 2 )+32− 12 = −60, g(0.5) = −10.125. (8.36)If the data contain little noise, this polynomial can be used with some confidencewithin the range of the data, but with risk beyond the range of the data.Notice that Lagrange interpolation makes no restriction that the points in thetable be evenly spaced. As a check, it is also worth noting that the sum of theLagrange multipliers equals one, ∑ ni=1 λ i =1. Usually the Lagrange fit is made toonly a small region of the table with a small value of n, even though the formulaworks perfectly well for fitting a high-degree polynomial to the entire table. Thedifference between the value of the polynomial evaluated at some x and that of theactual function is equal to the remainderR n ≃ (x − x 1)(x − x 2 ) ···(x − x n )g (n) (ζ), (8.37)n!where ζ lies somewhere in the interpolation interval but is otherwise undetermined.This shows that if significant high derivatives exist in g(x), then it cannotbe approximated well by a polynomial. In particular, if g(x) is a table of experimentaldata, it is likely to contain noise, and then it is a bad idea to fit a curve throughall the data points.8.5.2 Lagrange Implementation and AssessmentConsider the experimental neutron scattering data in Table 8.1. The expected theoreticalfunctional form that describes these data is (8.31), and our empirical fits tothese data are shown in Figure 8.3.1. Write a subroutine to perform an n-point Lagrange interpolation using (8.33).Treat n as an arbitrary input parameter. (You can also do this exercise withthe spline fits discussed in § 8.5.4.)2. Use the Lagrange interpolation formula to fit the entire experimental spectrumwith one polynomial. (This means that you must fit all nine data points−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 178

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!