I have a set of numbers $R$ with $n$ elements. For this example, let's use $R = \{2, 3, 5, 7\}$. In practice, it has about 20 to 30 elements. There's also a constant $P$. Let's use $P = 10$ for this.

I am trying to solve the following equation for $c$:

$\displaystyle\sum_{i=1}^n \left (\frac{R_i}{max(R)}\right )^c = P$

This example gets reduced too:

$\left (\frac{2}{7}\right )^c +\left (\frac{3}{7}\right )^c +\left (\frac{5}{7}\right )^c +\left (\frac{7}{7}\right )^c = 10$

I have no idea how to extract $c$ in this example, even less so in the general case. Some trial-error led to $c = -1.228079005$.

Is there a good way to compute this?


You probably cannot do better than an iterative scheme like Newton's method. Your function is $f(c)-P$, of which you are look for roots $c$. For a term like $a^c$, you have $(a^c)'=(\ln a)*a^c$. So find $f'(c)$ and iterate.

As a sanity check, make sure that $1\leq P\leq n$, otherwise this has no solution.


You won't find an algebraic approach that will work, you will have to use a numeric root finder. To get a starting value, it is probably easier to write your equation as $$\displaystyle\sum_{i=1}^n \left (\frac{\max(R)}{R_i}\right )^{-c} = P$$ and note that the term with the smallest $R_i$ will be larger (maybe much larger) than the rest so start by finding the $c$ which satisfies $\left (\frac{\max(R)}{\min (R)}\right )^{-c} = P$ and go from there.


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.