ohgodamnitw0

2022-09-06

Best way to handle the ratio which cannot be represented as floating point numbers.

I need to calculate the ratio of the form:

$s=\sum _{1}^{3}{q}_{i}$, $\phantom{\rule{1em}{0ex}}$${p}_{i}=\frac{{q}_{i}}{\sum _{1}^{3}{q}_{i}}$

where ${q}_{i}>0$. One problem is that ${q}_{i}$ are too small that they can not represented as floating point numbers, then I can try logarithms ${z}_{i}=\mathrm{l}\mathrm{o}\mathrm{g}({q}_{i})$ and $\mathrm{l}\mathrm{o}\mathrm{g}({p}_{i})=\mathrm{l}\mathrm{o}\mathrm{g}({q}_{i})-\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1}+{q}_{2}+{q}_{3})$, at this moment, I know $\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1})=-2012,\mathrm{l}\mathrm{o}\mathrm{g}({q}_{2})=-2013,\mathrm{l}\mathrm{o}\mathrm{g}({q}_{3})=-2014$, but how to deal with $\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1}+{q}_{2}+{q}_{3})$, any one could give me some idea?

thanks

I need to calculate the ratio of the form:

$s=\sum _{1}^{3}{q}_{i}$, $\phantom{\rule{1em}{0ex}}$${p}_{i}=\frac{{q}_{i}}{\sum _{1}^{3}{q}_{i}}$

where ${q}_{i}>0$. One problem is that ${q}_{i}$ are too small that they can not represented as floating point numbers, then I can try logarithms ${z}_{i}=\mathrm{l}\mathrm{o}\mathrm{g}({q}_{i})$ and $\mathrm{l}\mathrm{o}\mathrm{g}({p}_{i})=\mathrm{l}\mathrm{o}\mathrm{g}({q}_{i})-\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1}+{q}_{2}+{q}_{3})$, at this moment, I know $\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1})=-2012,\mathrm{l}\mathrm{o}\mathrm{g}({q}_{2})=-2013,\mathrm{l}\mathrm{o}\mathrm{g}({q}_{3})=-2014$, but how to deal with $\mathrm{l}\mathrm{o}\mathrm{g}({q}_{1}+{q}_{2}+{q}_{3})$, any one could give me some idea?

thanks

goffaerothMotw1

Beginner2022-09-07Added 10 answers

Hint

Let me suppose ${q}_{1}>{q}_{2}>{q}_{3}$. So,

${p}_{1}=\frac{{q}_{1}}{{q}_{1}+{q}_{2}+{q}_{3}}=\frac{1}{1+\frac{{q}_{2}}{{q}_{1}}+\frac{{q}_{3}}{{q}_{1}}}$

Now,

${p}_{2}={p}_{1}\frac{{q}_{2}}{{q}_{1}}$

${p}_{3}={p}_{2}\frac{{q}_{3}}{{q}_{2}}$

I suppose that this will give you your number for almost any accuracy (computing the required ratios from the logarithms).

Let me suppose ${q}_{1}>{q}_{2}>{q}_{3}$. So,

${p}_{1}=\frac{{q}_{1}}{{q}_{1}+{q}_{2}+{q}_{3}}=\frac{1}{1+\frac{{q}_{2}}{{q}_{1}}+\frac{{q}_{3}}{{q}_{1}}}$

Now,

${p}_{2}={p}_{1}\frac{{q}_{2}}{{q}_{1}}$

${p}_{3}={p}_{2}\frac{{q}_{3}}{{q}_{2}}$

I suppose that this will give you your number for almost any accuracy (computing the required ratios from the logarithms).

$\frac{20b}{{\left(4{b}^{3}\right)}^{3}}$

Which operation could we perform in order to find the number of milliseconds in a year??

$60\cdot 60\cdot 24\cdot 7\cdot 365$ $1000\cdot 60\cdot 60\cdot 24\cdot 365$ $24\cdot 60\cdot 100\cdot 7\cdot 52$ $1000\cdot 60\cdot 24\cdot 7\cdot 52?$ Tell about the meaning of Sxx and Sxy in simple linear regression,, especially the meaning of those formulas

Is the number 7356 divisible by 12? Also find the remainder.

A) No

B) 0

C) Yes

D) 6What is a positive integer?

Determine the value of k if the remainder is 3 given $({x}^{3}+k{x}^{2}+x+5)\xf7(x+2)$

Is $41$ a prime number?

What is the square root of $98$?

Is the sum of two prime numbers is always even?

149600000000 is equal to

A)$1.496\times {10}^{11}$

B)$1.496\times {10}^{10}$

C)$1.496\times {10}^{12}$

D)$1.496\times {10}^{8}$Find the value of$\mathrm{log}1$ to the base $3$ ?

What is the square root of 3 divided by 2 .

write $\sqrt[5]{{\left(7x\right)}^{4}}$ as an equivalent expression using a fractional exponent.

simplify $\sqrt{125n}$

What is the square root of $\frac{144}{169}$