One for the math minds

sysyphus

So they tell me
Joined
Feb 10, 2002
Messages
10,489
Location
Toronto
Often in my work I work with an equation that comes in the following form:

y = a1*x^b1+a2*x^b2+...+an*x^bn

Note that neither a nor b are not necessarily integers.

So in my application I am having to solve for x. The only way I can figure it out is through iteration (i.e. repeated guesses of x, insert into the equation, checking against my known value for y, repeat until convergence). Thsi is a pain to have to do over and over again.

I've tried solving the equation for x, but my maths skills have come up short since I left uni 10 years ago. I know there are a number of math savvy people here, I'm wondering if there is any way to solve this equation for x?
 
It's a hard problem ;)

The an's being non-integers isn't much of a problem. You can always multiply through by a common factor to make the an's integer (if the an's are rational i.e. fractions).

If the bn's are integers it's a bit easier and there is a formula for n <= 4 (quadratic formula for n=2 [easy], cubic formula for n=3 [hard], quartic formula for n=4 [formula is about a page long]). If n >4, there isn't a formula but you could factorise the equation (hard) or get a mathematical software package such as matlab or mathematica to solve it for you.

If the bn's aren't integers or n>4 the "guess and iterate" method is logically sound, use the Newton-Raphson method for finding roots of equations http://en.wikipedia.org/wiki/Newton's_method. That requires calculus (differentiation). You also need a good guess to start with so drawing a graph is a good way to start (again, software can do this for you). You can also use differentiation and algebra to find the places where the graph crosses the x axis to help you draw a graph.
 
All the other values are known?

Yes

It's a hard problem ;)

The an's being non-integers isn't much of a problem. You can always multiply through by a common factor to make the an's integer (if the an's are rational i.e. fractions).

If the bn's are integers it's a bit easier and there is a formula for n <= 4 (quadratic formula for n=2 [easy], cubic formula for n=3 [hard], quartic formula for n=4 [formula is about a page long]). If n >4, there isn't a formula but you could factorise the equation (hard) or get a mathematical software package such as matlab or mathematica to solve it for you.

If the bn's aren't integers or n>4 the "guess and iterate" method is logically sound, use the Newton-Raphson method for finding roots of equations http://en.wikipedia.org/wiki/Newton's_method. That requires calculus (differentiation). You also need a good guess to start with so drawing a graph is a good way to start (again, software can do this for you). You can also use differentiation and algebra to find the places where the graph crosses the x axis to help you draw a graph.

I figured that it would probably come down to using numerical methods rather than a simple rearranged equation. I was hoping for a simple formula that I could plug into Excel, but that was quite overoptimistic on my part.

I'll have to blow the dust off my nummeds text and employ a little VB instead. Thanks for your help.
 
Pah, screw programming, programming is hard. Get some free graphing software like SciLab, plot out the function, and zoom in those points as far as you need to.
 
Often in my work I work with an equation that comes in the following form:
y = a1*x^b1+a2*x^b2+...+an*x^bn
...
I've tried solving the equation for x, but my maths skills have come up short since I left uni 10 years ago. I know there are a number of math savvy people here, I'm wondering if there is any way to solve this equation for x?
You might be able to solve implicitly for x in terms of Hypergeometric or Generalized Hypergeometric functions (I'm just guessing really, but this method can handle polynomial equations of order 5 and higher, which can't be done algebraically). Still, the workload necessary isn't worth it, since any closed form expression found using these methods is bound to look awful anyway.

Graphing the danged thing, like Perfection suggested, is probably the way to go. I suggest Gnuplot. It's great and has versions for both windows and Linux.
 
Well if the values are known and they aren't totally wacky there might be a simple rearrangement that works. But you would need to post the equation.

Zooming in with a graph would work too for known constants.

Where do you get the functions from? Because it's quite rare to get functions with non-integer exponents (the bn's) from most applications I know of (e.g. statistics or something).
 
I'd use Matlab or Maple to solve it. VB can't do differentiation, AFAIK, so you'd have to program that as well. To be perfectly honest, if I had to use VB, I'd do it using VB + iterative trial and error...
 
Because it's quite rare to get functions with non-integer exponents (the bn's) from most applications I know of (e.g. statistics or something).
It's not too rare. A huge number of complex real-world systems roughly obey power law distributions, and since this is a sum of such distributions there are many, many fields this could have come from. My guess is chemistry or structural engineering ;)

see: http://en.wikipedia.org/wiki/Power_law
 
It's not too rare. A huge number of complex real-world systems roughly obey power law distributions, and since this is a sum of such distributions there are many, many fields this could have come from. My guess is chemistry or structural engineering ;)

see: http://en.wikipedia.org/wiki/Power_law

Bah. Applied maths (gets coat).
 
I've been waiting for so long to see the power law come up in my work...
In writing my Masters Thesis in quantum optics, power laws never came up. The reason is that the system I was studying (with a non-interacting electron approximation) was too simple.

As soon as you go to really complex systems, you get power laws.

My girlfriend is writing a Master's thesis about Wikipedia, and as soon as she had compiled data on article size and link distributions, sure enough a power-law distribution cropped up (related to Lotka's Law, but with a slightly lower power). This, of course, shows that the wikipedia article size data is a much more complex system than non-interacting electrons interacting with a laser.

Now, as soon as I add interactions to the electrons (thus necessitating huge computer-base calculuations) I'm pretty sure a power law will crop up.
 
I vaguely remember from my math classes that iterative zeroing was the most efficient way to solve such polynomial equations - like we did exercices to show how many iterations you would need to get an 99% approximate, then a 99.9% one, then a 99.99%... and it was suprisingly few.
 
It isn't a polynomial equation though from the sound of things (all the bn's would be positive integers then).

I don't know what you mean by iterative zeroing but there are quite a few numerical methods to solve equations, some better than others (Newton-Raphson is one of the simplest but Runge-Kutta is faster to converge but more complicated. It's just a higher-order version of Newton's method). Both of those methods work (for "well behaved" functions anyway).
 
I can't pass off too much info about the application as it is propietary to my company, but I will tell that the exponents are measures of time. The required precision dictates that I cannot round to integers. It is a chemical engineering application.
 
The required precision dictates that I cannot round to integers. It is a chemical engineering application.
Who called it!? :)

Yes, I recall reaction rates looking like that. Perhaps you'd do well to check the literature of Physical Chemistry or Analytical Chemistry to see what methods are in common use. The most common methods are often the best ones for a reason, since people generally want "the best" :)
 
Back
Top Bottom