C
C
ChesterLife2015-08-10 08:52:08
Programming
ChesterLife, 2015-08-10 08:52:08

How to implement the coefficient search algorithm?

There are equations of the form:
10.22 * K1 = S1
15.10 * K2 = S2
12.45 * K3 = S3
S1 + S2 + S3 = 410.25
How to implement an algorithm for finding the values ​​of K1, K2 and K3 so that the numbers converge? All numbers up to two decimal places. Can be rounded. There may be more equations.
It seems impossible to do without enumeration of values. Solutions, as I understand it, may not be found.
PS K is man-hours) it is necessary that the numbers converge to kopecks.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2015-08-10
@OLS

This is a system of linear equations ( https://ru.wikipedia.org/wiki/%D0%A1%D0%B8%D1%81%D... ).
1. If the number of equations P is strictly equal to the number of unknown variables N, then the system is solved unambiguously in most cases (there are several methods - choose which one you like best).
2. If the number of equations P is less than the number of unknown variables N, fix any (NP) variables with reasonable values ​​and solve the system as in step 1.
3. If the number of equations P is greater than the number of unknown variables N, then in most cases the system will not have an exact solution - only an approximate one (minimizing the error in the equations) - here look for the combination "least squares method".

G
GavriKos, 2015-08-10
@GavriKos

If s1, s2, s3 are unknown, and only their sum is known, then the system has a set of solutions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question