x = input('X? '); n = input('Degree? '); for i=0:1:n z = cos0approx(x, i); zPrev = cos0approx(x, i-1); true = cos(x); absEr = abs(true - z); disp('The value is:'); disp(z); disp('The true error is:'); disp(absEr); perRel = (absEr/cos(x)) * 100; disp('The percent relative true error is:'); disp(perRel); if i > 0 approxE = abs(zPrev - z); disp('The approximate error is:'); disp(approxE); approxEPer = abs(((zPrev - z) / z) * 100); disp('The percent relative approximate error is:'); disp(approxEPer); end end