Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a problem to find $x$ such that $$ \sum_{i}\left(\frac{a_i}{x}\right)^\lambda= \sum_{j}\left(\frac{b_j}{x}\right)^{-\lambda} $$

$a_i < x < b_j$

$a_i \approx x \approx b_j$

We get analytic solution: $$ x = \left[\frac{\sum_{i}a_i^\lambda}{\sum_{j}b_j^{-\lambda}}\right]^{\frac{1}{2\lambda}} $$

But since $a_i,b_j,x,\lambda \approx 10^3$ we cannot evaluate this formula because of numerical overflow ($a_i ^ \lambda \approx 1000^{1000}$)

Please advise. Thanks.

share|cite|improve this question
There's also the Computation Science StackExchange ( in Beta that can help with this sort of question (and needs some more love to stay alive!). Just sayin' :) – Damien Aug 27 '12 at 11:04
up vote 5 down vote accepted

The expression for $x$ is invariant under change of scale: $a'_i= s a_i$, $b'_j= s b_j$. So, use $s=10^{-3}$ and get those numbers close to 1. This probably helps.

share|cite|improve this answer
Thanks, lhf! It helps. – Serg Aug 10 '11 at 17:41

This is similar to what lhf said, but it might help. Set $A=\max_i a_i$ and $B=\max_i b_i$, then $$ x=\sqrt{\frac{A}{B}}\left[\frac{\sum_i\left(\frac{a_i}{A}\right)^\lambda}{\sum_i\left(\frac{b_i}{B}\right)^\lambda}\right]^\frac{1}{2\lambda} $$ I think that this should get you decent stability and keep the computation from overflowing.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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