# Doing calculations with the least possible error?

#### babaliaris

I'm an Electrical And Computer Engineer and currently solving simultaneous equations using matrices.

I've noticed that if I keep fraction numbers all the way until the final calculation and then use the calculator to calculate the final answer, I have the least possible error in my calculation.

But If along the way (solving the equation), I'm calculating all the fractions using the calculator, in the end, the answer has a huge error.

For example, right now I finished a 2x2 system with answers x = 2.05 and y = 14.7 while the correct answers are x = 2 and y = 14.

So are my thoughts correct? Because along the way I was calculating fractions, keeping only some of the decimal points, then the final answer had an error equal to the sum of all errors in the previous calculation?

So should I keep fractions untouched until the final calculation?

#### topsquark

Math Team
I'm an Electrical And Computer Engineer and currently solving simultaneous equations using matrices.

I've noticed that if I keep fraction numbers all the way until the final calculation and then use the calculator to calculate the final answer, I have the least possible error in my calculation.

But If along the way (solving the equation), I'm calculating all the fractions using the calculator, in the end, the answer has a huge error.

For example, right now I finished a 2x2 system with answers x = 2.05 and y = 14.7 while the correct answers are x = 2 and y = 14.

So are my thoughts correct? Because along the way I was calculating fractions, keeping only some of the decimal points, then the final answer had an error equal to the sum of all errors in the previous calculation?

So should I keep fractions untouched until the final calculation?
It's usually best to keep everything in exact form until you have to report the final answer. However this is sometimes not very practical for a Physical scientist or Engineer as it just clutters up the calculation. (Mathematicians are different in this respect as they have to report the exact answers.)

I usually keep at least 5 or 6 digits beyond how many significant digits I need to report, if I have to write down the numbers. (Usually my calculator will keep all 14 digits and I can refer to it back and forth.) That usually covers any rounding errors.

-Dan

#### skipjack

Forum Staff
. . . solving simultaneous equations using matrices.
Do the coefficients for the equations have known exact values?

#### babaliaris

Do the coefficients for the equations have known exact values?
yes.

Last edited:

#### romsek

Math Team
There's a lot more to minimizing matrix calculation errors than just retaining decimal places. There are whole courses on numerical linear algebra. (I took one)

There are strategies for selecting pivot rows and columns. There are methods for determining bounds on error. There are tricks for dealing with what are known as "poorly conditioned" matrix equations.

Nevertheless what you say is correct, you should try and retain fractions until it gets absurd.

• 2 people

#### DarnItJimImAnEngineer

• 1 person

#### skipjack

Forum Staff
. . . I finished a 2x2 system . . .
Can you post the equations for the system you mentioned?