Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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
1  
There's also the Computation Science StackExchange (scicomp.stackexchange.com) 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

2 Answers 2

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
    
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

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .