%% Computing the roots of a quadratic polynomials
% x^2-px+q=f(p,q)
% 
% Martin Stoll, 2018
p = -4;
q = 0.01;
rts = roots([1 -p q])
dgts = 4;
%% Compute the first Root of the polynomial
u = round(p^2/4,dgts, 'significant');
v = round(u-q,dgts, 'significant');
w = round(sqrt(v),dgts, 'significant');
y2 = round(p/2-w,dgts, 'significant')
%% VAR A
y1a = round(p/2+w,dgts, 'significant');
%% VAR B
y1b = round(q/y2,dgts, 'significant');
%% Errors
erra=abs(rts(2)-y1a)/abs(rts(2))
errb=abs(rts(2)-y1b)/abs(rts(2))

