
Hao L.
asked 05/14/21I am trying to add up integer multiples of 4 specific numbers and getting them as close as possible if not exact to a specific number
I want to know how to solve this:
5587.93728 = (101.4*a) + (208.8*b) + (429.8*c) + (884.1*d)
but all the variables a,b,c,d have to be integers . it is ok if its not exact but I want the right side of equation to be as close as possible to the left(less than 1 difference or at least 10)
Thank you!
3 Answers By Expert Tutors
Daniel B. answered 05/15/21
A retired computer professional to teach math, physics
Another solution: a=4, b=8, c=2, d=3

David B. answered 05/20/21
Math and Statistics need not be scary
I'll agree that there is probably some algebra with an optimum solution for the problem.
Being a pragmatic type, I just set up a simple simulator which put in values for each of the coefficients from 0 to a specific max (8,10,5, 4) for each of the variables. {a,b,c,d}. This I ran quite a few times because within just 500 iterations of my simulation, even when I tried changing the randomization parameters, I kept coming up to the same minimum error for the solution (error = difference between right side and left side) , the absolute value of which was .03728 which is equal to the un reducible remainder of the left side of the equation (as none of the values on the right have more than one decimal portion). The simulation converged fairly quickly each time. So, yea... Daniel, this looks like an exact answer. a = 4. b = 8. c = 2 and d = 3
Tom K. answered 05/15/21
Knowledgeable and Friendly Math and Statistics Tutor
Using the Euclidean algorithm, the least common multiple of 8841 and 4298 is 7.
The least common multiple of 8841 and 2088 is 3.
Thus, these three numbers will be sufficient to solve the problem.
We will let a = 0
Solve 8841/7 a + 4298/7 b = 1 and 8841/3 c and 2088/3 d = 1
1263 a + 614 b = 1
2947 c + 696 d = 1
I took the lazy way to solve and wrote a loop (we will flip the negative sign)
for(a in 1:613){for(b in 1:1262){if(a* 1263 - b * 614 == 1){
print(a)
print(b)
}}}
a = 193
b = 397
for(c in 1:695){for(d in 1:2946){if(c* 2947 - d * 696 == 1){
print(c)
print(d)
}}}
c = 427
d = 1808
Then, as 7 - 2*3 = 1, we have a solution to the triplet diophantine equation
Our solution for 8841 f + 4298 g + 2088 h = 1 will be
f = a - 2 * c
g = -b
h = 2d
(193 - 2 * 427)8841 - 397*4298 +(2 * 1808)2088 = 1
Now, let's revisit the original problem; as the left hand side is 5587.9, we will multiply our solutions by 55879
d = 55879(193 - 2 * 427)
c = 55879(-397)
b = 55879(2*1808)
a = 0
a = 0
b = 202058464
c = -22183963
d = -36936019
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Mark M.
You are multiplying numbers with only 1 decimal place by integers. Yet your want the result to have 5 decimal places. Not possible.05/15/21