# Solving a system of linear equations in Mathematica regarding the errors of different methods

I have a system of equations, i.e.

0.62243x + 0.51824y = 0.70524 0.71497x + 0.59496y = 0.80996

I have 3 ways to solve this system (there are more but I am interested in these 3):

1. Solve the first one for x and then substitute the x at the second equation.
2. Solve the first one for y and then substitute the y at the second equation.
3. Cramer's Rule

In each case, there are 2 ways to compute the solutions:

1. Truncation (in every single step) with precision of n decimal digits
2. Roundation (in every single step) with precision of n decimal digits

For example, I solve the first equation for x and then substitute the x at the second. Using NumberForm I get y=0.4000000000000674 (with precision of 16 decimal digits and truncation) and then x={{x -> 1.39866 (0.80996 - 0.59496*0.4000000000000674}}. However, NumberForm is not solving itself the system of the equations. On the other hand, using Solve I get y=0.4 and x=0.8. So there is an error with Solve (Also with NSolve).

The questions are:

1. How can I compute the solutions for specific precision of decimal digits both with truncation and roundation for all 3 methods? Specifically, I want to compute the solutions for 5, 50, 500, 5000, 50000 and 500000 decimal digits and decide which combination (out of the 3 methods and truncation or roundation) is the best. When I say the best way, I mean the way that the solutions converge faster to the real solution as the precision increase.

2. If I had

ax + by = c a'x + b'y = c'

is there a way to specify a range of a, b, c, a', b', c' that there is no error?

1. Is there a proof that the error depends on the mantissa of the computer?
• 500000 digits? You are kidding. – Henrik Schumacher Nov 8 '18 at 10:43
• Why 500000 digits is a problem? Since there's a way to solve for 5 digits, then it's just a matter of time I guess – Alex Spanos Nov 8 '18 at 11:04
• ok, so will limit the number of digits – Alex Spanos Nov 8 '18 at 11:24
• My former comment should have read: "Nobody needs 50000 digits. The ratio between the diameter of the observable universe and the diameter of a hydrogen atom is way below 10^40. You are about to leave the domain of what is scientifically meaningful." – Henrik Schumacher Nov 8 '18 at 11:25