I have a very complex math formula/equation which involves exponential.

Formula: X + 2 = Y

*PS: The above is just an example to illustrate my problem. The real formula is way more complex than this.

There is no way for me to form an equation with X variable on the left like X = Y - 2. I tried professional Math software like Maxima and Mathematica to solve the equation but failed.

I was given the value of Y, how can I find/estimate the value of X?

My current idea is start looping X = 1 and increase X's value with a fixed increment in each loop and try to match my value Y. The only relationship I have now is that the greater value of X generates a smaller value of Y.

Is there any good algorithm out there for my problem?

  • This is an algebra problem: solve for X. You need to refactor the equation to isolate Y, and then code that. In this case, X = Y -2. Jun 11 '16 at 4:42
  • @MatthewFlynn I had solved this problem. Just to let you know that my formula is way complex than what you can think of. It involves x^2, x^6, x^-0.09, x^-0.21 and lots of sqrt. Anyway it's solved with root finding algorithm.
    – Wilts C
    Jun 11 '16 at 5:42

If the equation cannot be solved analytically, you need to use numerical algorithm. To make it simple rewrite the equation into form of X + 2 - Y = 0.

Then, it becomes a problem of finding a root of equation using numerical method.

  • Numerical algorithm works perfectly in this case. Thanks!
    – Wilts C
    Jun 8 '16 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.