In: Computer Science
Perform all of these questions using MATLAB software.
5. The relative error in computation of
x-y for = 12.05 and y = 8.02 having absolute errors x=0.005 and y=-0.001.
6. Find the relative error in computation of x-y for x=9.05 and y= 6.56 having absolute errors x = 0.001
and y 0.003 respectively.
7.Find the relative error in computation of x+y for x= 11.75 and y= 7.23 having absolute errors x = 0.002
and y=0.005.
8. If y=4x^6-5x, find the percentage error in y at x=1, if the error is x=0.04.
Q.5:-
x=12.05; % Actual value of x
y=8.02; % Actual value of y
Absx=0.005; % absolute error of x
Absy=0.001; % absolute error of y
Rerx_y=(Absx/x -Absy/y) % final relative error of (x-y) ,we take
absolute value thats positive values only
Q.NO 6:-
x=9.05; % Actual value of x
y=6.56; % Actual value of y
Absx=0.001; % absolute error of x
Absy=0.003; % absolute error of y
Rerx_y=(Absy/y-Absx/x)% final relative error of (x-y) ,we take
absolute value thats positive values only
Q.NO.7:
x=11.75; % Actual value of x
y=7.23; % Actual value of y
Absx=0.002; % absolute error of x
Absy=0.005; % absolute error of y
Rerxplusy=(Absx+Absy)/(x+y) % final relative error of (x+y)
Q.No.8:-
x=0.04
yerr=4*x^6-5*x
x=1
yact=4*x^6-5*x
Rel_error=(yact-yerr)/yact
Rel_error_perct=Rel_error*100 %percentage error(approx. value)