Problem 5. Consider least squares polynomial approximation to f(x) = cos (nx) on x E [-1,1] using...
Problem 5. Consider least squares polynomial approximation to f(x) = cos (nx) on x E [-1,1] using the inner product 1. In finding coefficients you will need to compute the integral By symmetry, an 0 for odd n, so we need only consider even n. (a) Make a change of variables and use appropriate identities to transform the integral for a to cos (Bcos 8)cos (ne) de (b) The Bessel function of even order, (x), can be defined by the integral in cos (B sincos Notice the difference from the integral in part (b cos (B cos8) has been replaced by cos (Psin)). Use trig identities to show that が(-1)"rh"(6) 2. Show that the best degree 2N approximation to cos (Bx) using this inner product is 3. Write a MATLAB program that computes cos (θ) on θ -π, π] using the approximation de- rived in part (c). Your program should have the following features: · It should use the Tchebyshev recurrence formula to compute the functions T, (x) concur- rently with summing the series. It should store and re-use a table of the required Bessel functions lo (r), 12 (7), etc rather . than repeatedly computing them. MATLAB's function bessj will compute the Bessel func- You should find (either empirically or theoretically) the smallest number N such that the EgN (θ,-lcos@) _ P2Na (元 10-14 everywhere on θ € [-π, π]. tions for you error is less than or equal to τ 10-14 everywhere on Produce a plot showing dearly that the ror is less than or equal to τ θ ε [-π, π). Turn in hardcopy of your code and also the plot.
Problem 5. Consider least squares polynomial approximation to f(x) = cos (nx) on x E [-1,1] using the inner product 1. In finding coefficients you will need to compute the integral By symmetry, an 0 for odd n, so we need only consider even n. (a) Make a change of variables and use appropriate identities to transform the integral for a to cos (Bcos 8)cos (ne) de (b) The Bessel function of even order, (x), can be defined by the integral in cos (B sincos Notice the difference from the integral in part (b cos (B cos8) has been replaced by cos (Psin)). Use trig identities to show that が(-1)"rh"(6) 2. Show that the best degree 2N approximation to cos (Bx) using this inner product is 3. Write a MATLAB program that computes cos (θ) on θ -π, π] using the approximation de- rived in part (c). Your program should have the following features: · It should use the Tchebyshev recurrence formula to compute the functions T, (x) concur- rently with summing the series. It should store and re-use a table of the required Bessel functions lo (r), 12 (7), etc rather . than repeatedly computing them. MATLAB's function bessj will compute the Bessel func- You should find (either empirically or theoretically) the smallest number N such that the EgN (θ,-lcos@) _ P2Na (元 10-14 everywhere on θ € [-π, π]. tions for you error is less than or equal to τ 10-14 everywhere on Produce a plot showing dearly that the ror is less than or equal to τ θ ε [-π, π). Turn in hardcopy of your code and also the plot.