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