Output
Output
__________
a) (9.4e-05)+(3.6e+04) = 3.6000000094e+004
b) (9.4e-05)+(3.6e+04) = 3.6000e+004 (Upto 5 significant digits)
c) Absolute Error = 9.4000e-005
d) Relative Error = 2.6111e-009
Answer 2
__________
The value of exp(pi*sqrt(163)) is 2.62537412640768260e+017
Its relative error with the 18 digit integer 262537412640768744 is
1.8282901235e-015 which is quite insignificant.
Hence the two numbers are very close.
Answer 3
__________
Three Digit Rounding
--------------------a) 133+0.921 = 1.33921e+002
Rounded Number=134
Absolute Error = 7.90e-002
Relative Error = 5.89900e-004
b) 122-0.499= 1.21501e+002
Rounded Number=122
Absolute Error = 4.99e-001
Relative Error = 4.10696e-003
c) (121-0.327)-119= 1.6730e+000
Rounded Number=2.00
Absolute Error = 3.27e-001
Relative Error = 1.95457e-001
d) (121-119)-0.327= 1.6730e+000
Rounded Number=1.67
Absolute Error = 3e-003
x-(x^3)/3!
x-(x^3)/3!+(x^5)/5!
x-(x^3)/3!+(x^5)/5!-(x^7)/7!
x-(x^3)/3!+(x^5)/5!-(x^7)/7!+(x^9)/9!
x-(x^3)/3!+(x^5)/5!-(x^7)/7!+(x^9)/9!-(x^11)/11!
Errors at pi/6
--------------sin(pi/6)=0.5
Approximation
Absolute
-------------- --------------4.9967418e-001
3.25821e-004
Relative
-------------6.51641e-004
(first appx)
5.0000213e-001
2.13259e-006
4.26518e-006
(second appx)
4.9999999e-001
8.13098e-009
1.62620e-008
(third appx)
5.0000000e-001
2.02799e-011
4.05598e-011
(fourth appx)
5.0000000e-001
3.56865e-014
7.13730e-014
(fifth appx)
Errors at pi/4
--------------sin(pi/4)=0.70711
Approximation
Absolute
-------------- ---------------
Relative
--------------
7.0465265e-001
2.45413e-003
3.47066e-003
(first appx)
7.0714305e-001
3.62646e-005
5.12859e-005
(second appx)
7.0710647e-001
3.11611e-007
4.40685e-007
(third appx)
7.0710678e-001
1.75032e-009
2.92893e-001
(fourth appx)
7.0710678e-001
6.92801e-012
9.79768e-012
(fifth appx)
Errors at pi/2
--------------sin(pi/2)=1.00000
Approximation
Absolute
-------------- ---------------
Relative
--------------
9.2483223e-001
7.51678e-002
7.51678e-002
(first appx)
1.0045249e+000
4.52486e-003
4.52486e-003
(second appx)
9.9984310e-001
1.56899e-004
1.56899e-004
(third appx)
1.0000035e+000
3.54258e-006
5.00004e-001
(fourth appx)
9.9999994e-001
5.62589e-008
5.62589e-008
(fifth appx)
Errors at pi*3
--------------sin(pi*3)=0.00000
Approximation
Absolute
-------------- ---------------1.3010347e+002
1.30103e+002
Relative
-------------not defined
(first appx)
4.8958639e+002
4.89586e+002
not defined
(second appx)
-8.2100513e+002
8.21005e+002
not defined
(third appx)
7.9587236e+002
7.95872e+002
not defined
(fourth appx)
-5.0977738e+002
5.09777e+002
not defined
(fifth appx)
Result
3.0000e-005
Actual Value
3.47143e-005
Absolute Error
4.71429e-006
Relative Error
1.35802e-001
(x-u)/w
2.7000e+000
3.12429e+000
4.24262e-001
1.35795e-001
(x-u)*v
3.4286e+000
2.96295e+000
4.65638e-001
1.35810e-001
u+v
9.8767e+004
9.87650e+004
1.61424e+000
1.63440e-005
Thus the values are correct as per example 4 of the textbook and relative error
is smallest for u+v.
Example 5
__________
p-q = 1.60000e-004
Four digit rounding
--------------------------Approximation=2.00e-004
Absolute Error=4.00e-005
Relative Error =2.50e-001
Four digit chopping
------------------------Approximation=1.00e-004
Absolute Error=6.00e-005
Relative Error =3.75e-001
Therefore,the chopping has more relative error and has brought in inaccuracy.