Question

In: Advanced Math

Find polynomial of degree at most 1 best approximates function f(x) = ex in the sense...

Find polynomial of degree at most 1 best approximates function f(x) = ex in the sense of uniform approximation on [0,1]. give the error of approximation of the function f with this polynomial.

Solutions

Expert Solution


%%Matlab code for integration
clear all
close all
ff=@(x) exp(x);
%displaying the function
fprintf('For the function \n')
disp(ff)

%4th order polynomial
xx=linspace(0,1,10);
yy=ff(xx);

%matrix for 4th order polynomial
for i=1:length(xx)
  
    A(i,1)=1;
    A(i,2)=xx(i);
    A(i,3)=(xx(i)).^2;
    A(i,4)=(xx(i)).^3;
    A(i,5)=(xx(i)).^4;
  
    b(i,1)=yy(i);
  
end

fprintf('The coefficient Matrix is\n')
disp(vpa(A,3))

fprintf('b matrix is\n')
disp(b)

c=A\b;
fprintf('The 4th oder polynomial is f(x)=%f+(%f)*x+(%f)*x^2+(%f)*x^3+(%f)*x^4\n',c(1),c(2),c(3),c(4),c(5))

fun=@(x) c(1)+c(2).*x+c(3).*x.^2+c(4).*x.^3+c(5).*x.^4;
xx1=linspace(0,1,101);
yy1=fun(xx1);

fprintf('Error in polynomial is %e\n',norm(yy1-ff(xx1)))
hold on
plot(xx,yy,'r*')
plot(xx1,yy1)
xlabel('x')
ylabel('f(x)=exp(x)')
title('x vs. exp(x) plot')
legend('Actual Data','polynomial fit','location','best')
box on  
%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%


Related Solutions

Find the Taylor polynomial of degree 2 centered at a = 1 for the function f(x)...
Find the Taylor polynomial of degree 2 centered at a = 1 for the function f(x) = e^(2x) . Use Taylor’s Inequality to estimate the accuracy of the approximation e^(2x) ≈ T2(x) when 0.7 ≤ x ≤ 1.3
Using the function f(x)=ln(1+x) a. Find the 8 degree taylor polynomial centered at 0 and simplify....
Using the function f(x)=ln(1+x) a. Find the 8 degree taylor polynomial centered at 0 and simplify. b. using your 8th degree taylor polynomial and taylors inequality, find the magnitude of the maximum possible error on [0,0.1] c.approximate ln(1.1) using your 8th degree taylor polynomial. what is the actual error? is it smaller than your estimated error?Round answer to enough decimal places so you can determine. d. create a plot of the function f(x)=ln(1+x) along with your taylor polynomial. Based on...
Let f(x) = 1 + x − x2 +ex-1. (a) Find the second Taylor polynomial T2(x)...
Let f(x) = 1 + x − x2 +ex-1. (a) Find the second Taylor polynomial T2(x) for f(x) based at b = 1. b) Find (and justify) an error bound for |f(x) − T2(x)| on the interval [0.9, 1.1]. The f(x) - T2(x) is absolute value. Please answer both questions cause it will be hard to post them separately.
Find the second-degree Taylor polynomial of f(x)=ln(1+sinx) centered at x=0.
Find the second-degree Taylor polynomial of f(x)=ln(1+sinx) centered at x=0.
Consider the function below. f(x) = ex 3 + ex Find the interval(s) where the function...
Consider the function below. f(x) = ex 3 + ex Find the interval(s) where the function is decreasing. (Enter your answer using interval notation. If an answer does not exist, enter DNE.) Find the local maximum and minimum values. (If an answer does not exist, enter DNE.) Find the inflection point. (If an answer does not exist, enter DNE.) Consider the function below. f(x) = x2 x2 − 16 Find the interval(s) where the function is increasing. (Enter your answer...
Find/calculate the 3rd degree Taylor polynomial of the function f(x) = xcos(x) that is in the heighborhood of x = 0 as well as the heighborhood of x = (π/2)
  Find/calculate the 3rd degree Taylor polynomial of the function f(x) = xcos(x) that is in the heighborhood of x = 0 as well as the heighborhood of x = (π/2)
Find/calculate the 3rd degree Taylor polynomial of the function f(x) = xcos(x) that is in the heighborhood of x = 0 as well as the heighborhood of x = (π/2)
  Find/calculate the 3rd degree Taylor polynomial of the function f(x) = xcos(x) that is in the heighborhood of x = 0 as well as the heighborhood of x = (π/2)
Find a polynomial f(x) of degree 3 that has the indicated zeros and satisfies the given...
Find a polynomial f(x) of degree 3 that has the indicated zeros and satisfies the given condition. −5, 1, 2;    f(3) = 48 Find a polynomial f(x) of degree 3 that has the indicated zeros and satisfies the given condition. −3, −2, 0;    f(−4) = 24 Find a polynomial f(x) of degree 3 that has the indicated zeros and satisfies the given condition. −2i, 2i, 5;    f(1) = 40 Find the zeros of f(x), and state the multiplicity of each zero. (Order your...
Find the degree 4 Taylor polynomial of f (x) = sin(2x) centered at π/6
Find the degree 4 Taylor polynomial of f (x) = sin(2x) centered at π/6
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)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT