0

I feel that I could have solved this in my sleep in high school--but I've been "out of math shape" for too long.

I have a team working in Objective C (for an iPhone app), and I gave them the equation (i've written in long form but do have the correct sigma, n, i equation):

the sum of [a*(b+x)^c + d*(e+x)^f + … + hundreds of similar functions where constants are all known but different from each other] = the sum of [g*(h+x)^i + j*(k+x)^l + … + again, hundreds of similar functions where constants are all known but different from each other

the request: solve for x in the above (in terms of the constants)

In Microsoft Excel, I can simply do a "GoalSeek" to find x…but I don't know the math to either isolate x or to isolate a few simple formulas so that they can program this into Objective C.

Help!?!?

  • Have you an approximate idea of what is the solution ? If the coefficients do not show some specific structure, I am afraid that only numerical methods (as with Excel) will provide you a solution. Please clarify what you know. – Claude Leibovici Jan 18 '14 at 15:45
  • Very quick, Claude! Here is one real example: 1.1(1.02+x)^6 + 1.5(1.04+x)^5.5 = 2.5(1.045+x)^1.5 + 4.0(1.105+x)^0.5 – bacchus6 Jan 18 '14 at 16:20
  • in that example, x = approximately 18.5% or 0.185 using excel's goal seek – bacchus6 Jan 18 '14 at 16:20
  • and as you suggested, the only "structure" is (a) that the exponent will always be a number between zero and 10, and (b) that the coefficient in the parentheses will always be just above 1.0 – bacchus6 Jan 18 '14 at 16:22
  • i've searched message boards and only found that "simulated annealing" is suggested as a method similar to excel's goal seek. – bacchus6 Jan 18 '14 at 16:25

1 Answers1

1

My preliminary assumption is that you have a rougth estimate of the solution you are looking for.

Let me write your equation as F being the sum over "i" (i=1 to N) of
A(i) (B(i) + C(i) x)^D(i)

Then the derivative is dF, the sum over "i" (i=1 to N) of
A(i) C(i) D(i) (B(i) + C(i) x)^(D(i) - 1)

So, call x_old your initial guess and use Newton iteration scheme which is
x_new = x_old - F(x_old) / dF(x_old)

and repeat it (replacing x_old by x_new) until you reach the desired accuracy level.

For the example you gave, let admit the estimate to be 0.5. So, applying what I wrote, we have the following iterates : 0.500000, 0.311039, 0.212724, 0.186821, 0.185203, 0.185197 and this is the end of the story for six significant digits. For this value of "x", the value of the function is -4.44089*10^-15.

But again, you must have a reasonable starting point.

Please let me know if this helps.

  • Claude--I saw your profile--for claiming to be "old," you are as sharp as they come! Yes, you're right…I expect x in fact to always be somewhere between -0.25 and 0.50…and a starting point of 0.50 or even 0.25 would be good. In that scheme, you only needed four, maybe five iterations to get to a number that is acceptable for me (as I am only showing these x's as a whole percentage like "19%" anyway). I think this means the amount of computational resources should be small. If so, brilliant! I will ask my programmers to try this…and likely hear from them on Tuesday. Thank you, sir. – bacchus6 Jan 18 '14 at 16:43
  • @bacchus6. This is simple ! Your programmers would need a couple of minutes to implement my junk ! By the way, if you like this answer, you can accept it. Cheers. – Claude Leibovici Jan 18 '14 at 16:46
  • Great--just one more question…does the initial estimate need to be the largest possible value? Or could you have started with 0.1 as an estimate in my example? – bacchus6 Jan 18 '14 at 16:54
  • @bacchus6. Not at all; just start with a reasonable value. If I start with 0.1, the successive iterates are 0.206366, 0.186172, 0.185199, 0.185197. – Claude Leibovici Jan 18 '14 at 16:57