Question

In: Advanced Math

let p3x be the third order polynomiol interpolatign function f(x)=sin(x) at 0,1/3,2/3,1 show that for any...

let p3x be the third order polynomiol interpolatign function f(x)=sin(x) at 0,1/3,2/3,1 show that for any x in [0,1] we have f(x)-p3(x), or equal to 1/54

Solutions

Expert Solution


%%Matlab code for 4th degree polynomial
clear all
close all

%all data points
x=[0 1/3 2/3 1];
y=sin(x);

fprintf('x vector is\n')
disp(x')

fprintf('y vector is\n')
disp(y')

%Matrix for 4th degree polynomial
for i=1:length(x)
  
    A(i,1)=1;
    A(i,2)=x(i);
    A(i,3)=(x(i)).^2;
    A(i,4)=(x(i)).^3;
  
end
fprintf('Coefficient matrix is \n')
disp(vpa(A,3))

%all coefficients are
p=A\y';

fprintf('The 3rd degree polynomial is\n')
fprintf('\tp(x)=(%f)+(%f)*x+(%f)*x^2+(%f)*x^3\n',p(1),p(2),p(3),p(4))

%plotting actual and fitted data
figure(1)
hold on
plot(x,y,'r*')
pp=@(t) p(1)+p(2).*t+p(3).*t.^2+p(4).*t.^3;
plot(x,pp(x))

xlabel('x')
ylabel('sin(x)')
title('x vs. y(x) plot')
legend('Actual data','polynomial fit','location','best')
box on; grid on;
xx=linspace(0,1);
yy=pp(xx);
fprintf('Error norm for 3rd order polynomial fit is %f\n',norm(yy-sin(xx)))
%%%%%%%%%%%%%%%%%%%%    End of Code %%%%%%%%%%%%%%%%%%%


Related Solutions

let f be the function on [0,1] given by f(x) = 1 if x is different...
let f be the function on [0,1] given by f(x) = 1 if x is different of 1/2 and 2 if x is equal to 1/2 Prove that f is Riemann integrable and compute integral of f(x) dx from 0 to 1 Hint for each epsilon >0 find a partition P so that Up (f) - Lp (f) <= epsilon
Find the third MacLaurin polynomial for the function f(x) = e2x sin(3x)
Find the third MacLaurin polynomial for the function f(x) = e2x sin(3x)
Let f ( x , y ) = x^ 2 + y ^3 + sin ⁡...
Let f ( x , y ) = x^ 2 + y ^3 + sin ⁡ ( x ^2 + y ^3 ). Determine the line integral of f ( x , y ) with respect to arc length over the unit circle centered at the origin (0, 0).
Let x = (1,1) and y = (3,1). 1. Find an explicit hyperbolic isometry f that...
Let x = (1,1) and y = (3,1). 1. Find an explicit hyperbolic isometry f that sends the semicircle that x and y lie on to the positive part of the imaginary axis. Write f as a composition of horizontal translations, scalings, and inversions. 2. Compute f(x) and f(y). 3. Compute d_{H^2}(f(x),f(y)) and verify that f is an isometry.
Let f be a continuous function on the closed interval [0,1] with a range also contained...
Let f be a continuous function on the closed interval [0,1] with a range also contained in [0,1]. Prove that f that there exists an x in [0,1] such that f(x)=x. Is the same explanation still valid if f is not continuous?
Find the root of the function f(x) = 8 - 4.5 ( x - sin x...
Find the root of the function f(x) = 8 - 4.5 ( x - sin x ) in the interval [2,3]. Exhibit a numerical solution using Newton method.
Let f(x) = sin(x) for -pi < x < pi and be ZERO outside this interval...
Let f(x) = sin(x) for -pi < x < pi and be ZERO outside this interval a. Find the Fourier Transformation. Plot on Desmos. b. Find the Fourier Integral representation of f(x). Plot on Desmos using reasonable limits of integration
For the given function determine the following: f (x) = (sin x + cos x) 2...
For the given function determine the following: f (x) = (sin x + cos x) 2 ; [−π,π] a) Find the intervals where f(x) is increasing, and decreasing b) Find the intervals where f(x) is concave up, and concave down c) Find the x-coordinate of all inflection points
6. (a) let f : R → R be a function defined by f(x) = x...
6. (a) let f : R → R be a function defined by f(x) = x + 4 if x ≤ 1 ax + b if 1 < x ≤ 3 3x x 8 if x > 3 Find the values of a and b that makes f(x) continuous on R. [10 marks] (b) Find the derivative of f(x) = tann 1 1 ∞x 1 + x . [15 marks] (c) Find f 0 (x) using logarithmic differentiation, where f(x)...
Let f be the periodic function defined by f(x) = 1 + x|x|, −1 < x...
Let f be the periodic function defined by f(x) = 1 + x|x|, −1 < x < 1, and f(x) = f(x + 2). Find the Fourier series of f.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT