% actual value given by the textbook exact = -1.99899998; % excute h1_11b & h1_11c to get answer_b % and answer_c h1_11b h1_11c % relative error = |p-p*|/|p| where p is the % exact solution and p* is an approximation to p rel_1 = abs(exact-answer_11b)/abs(exact) rel_2 = abs(exact-answer_11c)/abs(exact) % rel_2 = abs(exact-(-2))/abs(exact)