Question

In: Advanced Math

On the interval [-1,1], consider interpolating Runge’s function f(x) = 1/ (1 + 25x^2) By Pn(x),...

On the interval [-1,1], consider interpolating Runge’s function f(x) = 1/ (1 + 25x^2) By Pn(x), use computer to graph:

(c) Take 11 equally spaced nodes in [-1,1], starting at –1, ending at 1, and obtain the interpolating polynomial P10(x). Also, use 11 Chebyshev nodes in [-1,1] and obtain Pc(x), the corresponding interpolating polynomial. In the same graph, plot the three functions f(x), P10(x) and Pc(x) over the interval [-1,1] . Use different line-styles, so that f(x), P10(x) and Pc(x) look distinct.

b)Comment on the error formula for the nth degree interpolating polynomial by only computing the first three derivatives of f(x). Explain how accuracy will be lost (or gained) by interpolating f(x) at more points (by increasing n)

Solutions

Expert Solution

please give thumsup

We have developed a MATLAB code for the given problem. Here, input of the function is the degree of the polynomial.

---------------------MATLAB code---------------------

function Runge_function(n)
% n=degree of the polynomial;
% Therefore, number of data popints is n+1;

fx=@(x) 1./(1+25*x.^2);
a=-1;
b=1;
x_exact=a:0.01:b;
y_exact=fx(x_exact);

x=(a:(b-a)/n:b)';
y=fx(x);

A=x.^(0:n);
coeff=(A'*A)\(A'*y);

fprintf('\nRequired %g th degree polynomial is: \n\n',n)
fprintf(' y= %g + (%g) x',coeff(1),coeff(2))
for i=3:n+1
fprintf(' + (%g) x^%g',coeff(i),i-1);
end
fprintf('\n\n')

xx=a:0.01:b;
yy=0*xx;
y2=0*x;

for j=0:n
yy=yy+coeff(j+1)*xx.^j;
y2=y2+coeff(j+1)*x.^j;
end

VarNames = {'x','exact_y','approx_y','Absolute_error'};
TT=table(x,y,y2,abs(y-y2), 'VariableNames',VarNames);
disp(TT);

figure(1)
plot(xx,yy,'-',x_exact,y_exact,'--',x,y,'*k','LineWidth',1.25);
xlabel('x','fontsize',14)
ylabel('y(x)','fontsize',14)
legend('Polynomial','Actual curve','Node points')
title('Regression line vs Actual data','fontsize',14);
end

(a)

(b)

(c)


Related Solutions

Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial...
Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial determined by m equidistant interpolation points, (2) an interpolating polynomial determined by interpolation at the m zeros of the Chebyshev polynomial T_m(x), and (3) by interpolating by cubic splines instead of by a polynomial. Estimate the approximation error by evaluation max_i |f(z_i)-p(z_i)| for many points z_i on [-1,1]. For instance, you could use 10m points z_i. The cubic spline interpolant can be determined in...
the function F:(-1,1)toR dfined by F(x)=x/(1-x^2) is homeomorphism in a topology.. please explain the answer for...
the function F:(-1,1)toR dfined by F(x)=x/(1-x^2) is homeomorphism in a topology.. please explain the answer for me
Q.3 Consider the function f(x) = x^2– 2x + 4 on the interval [-2, 2] with...
Q.3 Consider the function f(x) = x^2– 2x + 4 on the interval [-2, 2] with h = 0.25. Write the MATLAB function file to find the first derivatives in the entire interval by all three methods i.e., forward, backward, and centered finite difference approximations.
Consider the function on the interval (0, 2π). f(x) = sin(x)/ 2 + (cos(x))^2 (a) Find...
Consider the function on the interval (0, 2π). f(x) = sin(x)/ 2 + (cos(x))^2 (a) Find the open intervals on which the function is increasing or decreasing. (Enter your answers using interval notation.) increasing decreasing (b) Apply the First Derivative Test to identify the relative extrema. relative maximum (x, y) = relative minimum (x, y) =
Consider the function f(x)= x3 x2 − 1 Express the domain of the function in interval...
Consider the function f(x)= x3 x2 − 1 Express the domain of the function in interval notation: Find the y-intercept: y=   . Find all the x-intercepts (enter your answer as a comma-separated list): x=   . On which intervals is the function positive?   On which intervals is the function negative?   Does f have any symmetries? f is even;f is odd;     f is periodic;None of the above. Find all the asymptotes of f (enter your answers as equations): Vertical asymptote (left):   ; Vertical...
Using Matlab, consider the function f(x) = x^3 – 2x + 4 on the interval [-2,...
Using Matlab, consider the function f(x) = x^3 – 2x + 4 on the interval [-2, 2] with h = 0.25. Write the MATLAB function file to find the first derivatives in the entire interval by all three methods i.e., forward, backward, and centered finite difference approximations. Could you please add the copiable Matlab code and the associated screenshots? Thank you!
Consider the function and the value of a. f(x) = −2 x − 1 , a...
Consider the function and the value of a. f(x) = −2 x − 1 , a = 9. (a) Use mtan = lim h→0 f(a + h) − f(a) h to find the slope of the tangent line mtan = f '(a). mtan =   (b)Find the equation of the tangent line to f at x = a. (Let x be the independent variable and y be the dependent variable.)   
Consider the function on the interval (0, 2π). f(x) = sin(x) cos(x) + 2 (a) Find...
Consider the function on the interval (0, 2π). f(x) = sin(x) cos(x) + 2 (a) Find the open interval(s) on which the function is increasing or decreasing. (Enter your answers using interval notation.) increasing     ( )    decreasing     ( )   (b) Apply the First Derivative Test to identify all relative extrema. relative maxima     (x, y) =    (smaller x-value) (x, y) = ( )    (larger x-value) relative minima (x, y) =    (smaller x-value) (x, y) = ​   ...
Consider the function. f(x) = x^2 − 1, x ≥ 1 (a) Find the inverse function...
Consider the function. f(x) = x^2 − 1, x ≥ 1 (a) Find the inverse function of f. f ^−1(x) = (b) Graph f and f ^−1 on the same set of coordinate axes. (c) Describe the relationship between the graphs. The graphs of f and f^−1 are reflections of each other across the line ____answer here___________. (d) State the domain and range of f and f^−1. (Enter your answers using interval notation.) Domain of f Range of f Domain...
Consider the function f(x)= 7 - 7x^2/3 defined on the interval [-1, 1]. State which of...
Consider the function f(x)= 7 - 7x^2/3 defined on the interval [-1, 1]. State which of the three hypotheses of Rolle’s Theorem fail(s) for f(x) on the given interval.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT