Python Forum
Brute Force method for solving equation - help needed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Brute Force method for solving equation - help needed
#1
Lightbulb 
Hello,

Could anybody check if is possible to solve below equations by Brute Force method using Phyton? Unfortunately standard arithmetic or determinants methods doesn't work - set of equations don't have solution. I though about Brute Force method but I am not a programmer.

l*n - 60*l*b - 60*l*a*n + 3600*l*a*b = 43945.8598

l*n - 30*l*b - 30*l*a*n + 900*l*a*b = 43954.1614

l*n + 30*l*b + 30*l*a*n + 900*l*a*b = 43973.1560

l*n + 60*l*b + 60*l*a*n + 3600*l*a*b = 43982.4109

or shorter version if we set variables as: ln=W; lb=Z lan=Y; lab=X;

1W – 60Z – 60Y + 3600X = 43945.8598

1W – 30Z – 30Y + 900X = 43954.1614

1W + 30Z + 30Y + 900X = 43973.1560

1W + 60Z + 60Y + 3600X = 43982.4109

The expected values are: length l = ~30 000m, n = ~1.46, a and b are constans, a should be in the range 10E-5...10E-7, b should be in the range 10E-4...10E-6

Thank You very much for help.
Reply
#2
The problem is not with the resolution method. The system of equations does NOT have a solution, whathever the resolution method it will not have a solution.

The system is a very simple linear system of 4 equations with 4 unknowns but this system has rank 3, which means that the equations are not independent. Denoting L0 L1 L2 L3 the lines of the system, if you compute L[0] - 2 * L[1] + 2 L[2] - L[3] it gives 0 on the left hand side, but it does not give 0 on the right hand side because
>>> A = [43945.8598, 43954.1614, 43973.1560, 43982.4109]
>>> A[0] - 2 * A[1] + 2 * A[2] - A[3]
1.4381000000066706
>>> 
It means that the system does not have a solution because 0 is not equal to 1.4381. Note it is not far from having a solution because 1.4381 is much smaller that 43945, so we may think that the error is due to inaccuracy of data. Also if the above sum was 0, the system would have not only one solution but an infinite number of solutions because there are less independent equations than the number of variables.

Also note that you can reduce the number of variables because if one writes T = Z + Y, the system can be written

Output:
1W – 60 T + 3600X = 43945.8598 1W – 30 T + 900X = 43954.1614 1W + 30 T + 900X = 43973.1560 1W + 60 T + 3600X = 43982.4109
The system is overdetermined: too many incompatible equations.
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
Thank You very much for comprehensive answer!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020