0

I'm trying to write a functional procedure. Doesn't matter the language, but I'm trying to solve for X in this instance.

24898.76 = (((( X * 3.9571 )/ 6.9) * 2) + ((2 - 1) * (( X * 3.9571 )/ 6.9)))

Anyone can assist with how would I go about solving this problem? Trying to remember math classes. to figure out how to do something like this. but keep coming up blank. Would greatly appreciate the assistance.

Another way to look at it

n = equation needs to equal, w = a float that can change, g = a float that can change, l = an integer number, X = trying to solve

n= ( (((X*w)/g) * 2) + ((l-1)*((X*w)/g)))
Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
A.I.
  • 1
  • 2
  • 1
    Please don't add new information in comments. It belongs in your post. – isherwood Apr 29 '22 at 17:28
  • Stackoverflow is for programming questions. – President James K. Polk Apr 29 '22 at 18:06
  • fit `X` with any search applicable to your function like [approximation search](https://stackoverflow.com/a/36163847/2521214) ... In rare occasion when function is monotonic you can use **binary search** instead ... so loop `X` in its range using the search and use `err = fabs(n - ( (((X*w)/g) * 2) + ((l-1)*((X*w)/g))));` as optimization error (minimize it). If you want to go for algebraic solution then convert your formula to polynomial of `X` and solve its roots ... – Spektre Apr 29 '22 at 18:12
  • 3
    A complex formula? This is a polynomial of degree one! That is, you can write it in the form **aX+b=0**. You can make the change of variable **y=Xw/g** , this simplifies. – Stéphane Laurent Apr 30 '22 at 07:07

0 Answers0