I'm solving a set of equations as part of a simple fixed point optimization algorithm that I am implementing in MATLAB.
I have a set of N numbers A={a(1),a(2),.......,a(N)}. Each a(i) is a member of the positive reals. No order or pattern is presumed in the values of A. I am trying to solve the following equation:
sum(i=1:N){1/(a(i)+x)}=C
To give a simple numerical example with N=4, A={1,3,2,0.5), and C=10:
(1/(1+X))+(1/(3+X))+(1/(2+X))+(1/(0.5+X))=10
I can solve x by multiplying through the denominator, creating a 4th order polynomial and then solving this polynomial, but this is a lot of work and not feasible for large datasets (e.g, I have a dataset with n=10000). I'm sure that there must be a simple mathematical trick for solving this function, but I can't seem to find it. Please does anyone have any idea about this?
I really do not understand the question. You have a problem that is equivalent to finding the roots of a polynomial of degree n with rational coefficients. (You say real numbers, but all are expressed in a finite number of digits and so are rational.) You then say that there must be a simple mathematical trick for solving this problem much more quickly than solving the root problem itself. This makes no sense. If two problems are equivalent, then the quickest time required to solve problem A is no longer than the quickest time required to solve problem B plus the quickest time required to translate problem A into problem B. So if there is a super quick way to solve your problem, people would have been using it to find roots of polynomials for decades.
You say that finding the roots of a polynomial of degree n is "not feasible" for large n. I have no idea what you mean.
It is true that it is not possible to find
exact decimal representations of the roots of all polynomial equations of degree n with rational coefficients.
For a very simple example, \(\displaystyle \dfrac{1}{2 + x} = 7 \implies 1 = 14 + 7x \implies x = - \dfrac{13}{7}\) has no exact decimal representation.
Is that what you mean by "not feasible"?
Or do you mean that the time it takes for a computer to solve the problem to some degree of approximation in decimal representation is too long for some purpose? I am not a computer person, but I remember finding a root of a high degree polynomial on a computer decades ago. If I remember correctly, the time required to find a root using a method of successive approximations depended a lot on whether you could provide a decent initial approximation. Do you have any constraints on the root you want to find if one exists?
Or are you saying that a polynomial of even degree may have no real roots for a computer to approximate, and for that reason a solution is "not feasible." But since your problem is equivalent to the polynomial problem, that means your problem may have no solution either.
I took a numerical method course in the sixties and have probably not worked on anything related to such methods in forty years. But if your problem involves finding an approximate solution if any exist within some bounded region, I suspect that a computer can find out fairly quickly. If that your problem, I suspect someone here can give guidance (not me: I have forgotten almost all I ever knew, which was not much, about numerical methods).