Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Lab 2: Errors and Error Propagation

Task 1:

Serial No Decimal Number Normalised Normalised Binary Binary Mantissa Binary


Decimal(8sdg) (8sdg) Exponent
1 1/2 0.5000000010 0.100000002 0.10000000 0
2 1/3 0.3333333310 0.010101012 0.01010101 -2
3 1/7 0.1428571410 0.001001002 0.00100100 -3
4 1/8 0.1250000010 0.001000002 0.00100000 -3
5 1/10 0.1000000010 0.000110012 0.00011001 -4
6 π 3.1415926510 11.0010012 1.10010010 1
7 √2 1.4142135610 1.01101012 1.01101010 0
8 1/√2 0.7071067810 0.101101012 1.1011101 -1
9 √3 1.7320508110 1.10111012 1.1011101 0
10 185/8 23.1250000010 10111.001000002 1.01110010 4
Task 2:
Experiment 1:
The following images portray the code to calculate machine epsilon in both Octave GUI and
in the Python IDLE

Experiment 2:
Experiment 3:
After Computation of the machine epsilon of my device on the Octave GUI the
following result was gotten:
epsilon = 0.025000
r = 0.9750
epsilon = 0.012500
r = 0.9875………
epsilon = 4.4409e-17
r=1
While the following result was gotten on the python IDE
The value of r is = 1.0
The machine epsilon is = 1.1102230246251565e-16
Experiment 4:
Computing the machine epsilon using the format long, gave the values:
epsilon = 2.500000000000000e-02
r = 0.975000000000000
epsilon = 1.250000000000000e-02
r = 0.987500000000000
epsilon = 6.250000000000000e-03
r = 0.993750000000000…..
epsilon = 8.881784197001253e-17
r = 1.000000000000000
epsilon = 4.440892098500626e-17
r=1

Experiment 5:
After calculating the different values of Epsilon as different divisors, the following
results were produced:
With divisor 3.0, the values are:
epsilon = 0.025000
r = 0.9750
epsilon = 8.3333e-03
r = 0.9917…..
epsilon = 1.2142e-16
r = 1.0000
epsilon = 4.0474e-17
r=1
With divisor 3.5, the vales are:
epsilon = 0.025000
r = 0.9750
epsilon = 7.1429e-03
r = 0.9929……
epsilon = 1.7872e-16
r = 1.0000
epsilon = 5.1063e-17
r=1
With divisor 5.0, the vales are:
epsilon = 0.025000
r = 0.9750
epsilon = 5.0000e-03
r = 0.9950……
epsilon = 2.6214e-16
r = 1.0000
epsilon = 5.2429e-17
r=1

Experiment 6:
After plotting a graph to describe the values at different value ranges, the following
image shows the graphs displayed in the octave GUI for each value:
Experiment 6:
The code is an iterative process where `epsilon` is successively divided by 2.0 first
then other values later, and the value of `r` is updated accordingly. The loop
continues until the absolute value of `r < 1.0` is no longer less than 1.0. This loop
effectively refines the value of `epsilon` to achieve a desired condition involving `r`.
Task 3:
Experiment 1:
After using each machine epsilon value to get my machine gamma, the following
results were gotten:
Machine Epsilon: 0.0250003 Machine Gamma: 2.775558e-18
Machine Epsilon: 0.008333 Machine Gamma: 9.251822e-19
Machine Epsilon: 0.007143 Machine Gamma: 7.930212e-19
Machine Epsilon: 0.005000 Machine Gamma: 5.551115e-19
Experiment 2:
The following observations can be made:
1.Decreasing Epsilon Values: As the machine epsilon decreases, it indicates an
improvement in the precision of the floating-point representation. Smaller machine
epsilon values suggest that the system can represent smaller differences between
floating-point numbers.

2.Relationship with Machine Gamma: Machine gamma is the smallest positive


number that, when added to 1.0, yields a result different from 1.0. The results show
that as machine epsilon decreases, machine gamma also decreases. This is
expected because a smaller epsilon means that the system can represent smaller
differences, so the smallest positive number that causes a difference from 1.0
becomes smaller.

In summary, the observations suggest that as the machine epsilon decreases,


indicating increased precision, the corresponding machine gamma decreases,
reflecting the smallest positive number that can be added to 1.0 to produce a
distinguishable result. However, the extremely small values of machine gamma also
underscore the inherent limitations of numerical precision in floating-point arithmetic.

You might also like