Problem 2-Modify textbook problem 4.11 (both editions) by evaluating the followi
ID: 3588653 • Letter: P
Question
Problem 2-Modify textbook problem 4.11 (both editions) by evaluating the following function at x = 0.3. 2! 3! 4! Problem 3-Plot the function (x)-2x-x+4 for the interval [2, 2]. Determine the exact value of the first derivative of the function at x-1 using calculus method. Then, numerically determine the first derivative of the function at x=1 using forward, backward, and centered difference approximations with a step size of h=0.5. Compare the approximate derivatives with the exact value and comment on which of the three finite difference approximations is most accurate.Explanation / Answer
Solution:
Executable code:
Matlab code:
clc
clear all
% FOR ITERATION
n1=1; % for iteration
c11=1:100;
% INITIALIZING 1ST VALUE USING MACLAURIAN SERIES
value(1)=((-1)^(1+1)*0.74^(2*1-1))/(2*1-1);
% PERCENTAGE ERROR
errorpercent(1)=abs((atan(0.74)-value(1))*100/atan(0.74));
while n1<100
n1=n1+1;
value(n1)=((-1)^(n1+1)*0.74^(2*n1-1))/(2*n1-1);
% SUMMATION ACCORDING TO MACLAURIAN SERIES FORMULA
value(n1)=value(n1-1)+value(n1);
errorpercent(n1)=abs((atan(0.74)-value(n1))*100/atan(0.74));
end
A=[c11;errorpercent;value];
fileIDs = fopen('result.txt','w');
fprintf(fileIDs,' N(ITERATION) PERCENTAGE ERROR VALUE ');
fprintf(fileIDs,'%d %6.2f %1.4f ',A);
fclose(fileIDs);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.