% Skript zur Musterlösung
%
% Numerische Mathematik, SS 2013
%
% Stabilität einer Lösungsformel
%
% Ingolf Busch, Juni 2013

b = single(3.6678);
c = single(2.0798e-3);

s1 = b^2;
s2 = single(4)*c;
s3 = s1-s2;
s4 = sqrt(s3);
s5 = b+s4;
x_1 = s5/2;
s6 = b-s4;
x_2 = s6/2;
x_2_stab =c/s5; 

fprintf(1,'Schritt             Ergebnis\n');
fprintf(1,'----------------------------\n');
fprintf(1,'s1=b^2           %11.8f\n',s1);
fprintf(1,'s2=4c            %11.8f\n',s2);
fprintf(1,'s3=s1-s2         %11.8f\n',s3);
fprintf(1,'s4=sqrt(s3)      %11.8f\n',s4);
fprintf(1,'s5 = b+s4        %11.8f\n',s5);
fprintf(1,'x_1 = s5/2       %11.8f\n',x_1);
fprintf(1,'s6 =b-s4         %11.8f\n',s6);
fprintf(1,'x_2 = s6/2       %11.8f\n',x_2);
fprintf(1,'x_2_stab = c/x_1 %11.8f\n',x_2_stab);