How to calculate the product of a sequence?

3.5k Views Asked by At

So I am wondering: how can you calculate the product of a sequence? I am doing this because I am making a population simulator. So I have the formula Survival chance = $1-a*x^2$ where $x$ is age in years. The survival chance denotes the chance one individual of age $x$ will survive that year. a is a constant.

Now more interesting: I want to find the life expectancy. To find the life expectancy the product of a sequence of this formula must be $0.5$, starting at the age of $0$. So how can I find the product of the sequence?

So: say $1-0.00008x^2$, which means the product of the sequence of the formula from $0$ to $x$, where $x$ is the life expectancy. I can equal this to $0.5$. But how can I single out $x$? I do not even know how to calculate the product of a sequence.

3

There are 3 best solutions below

1
On

You will get a very high degree polynomial, which you will not be able to solve algebraically. You will be able to solve it numerically. You just multiply all the terms together. In your model, the chance of surviving the first five years is $1 \cdot (1-a)(1-4a)(1-9a)(1-16a)$. If you want this to be $0.5$ you have a quartic in $a$, which can be solved, but if you want the chance of surviving ten years you are sunk.

Note that the life expectancy is not the year in which the surviving fraction drops below $0.5$, it is the mean of the lifetimes. With your distribution I think the life expectancy will be lower than the age mortality reaches $0.5$ because some of the people have died very young but few will survive past the year mortality crosses $0.5$.

0
On

$\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Following $\texttt{@Ross Millikan}$ precise answer and with $\ds{n \geq 0}$, the "chance of surviving the first $\ds{n}$ years" as $\texttt{@Ross Millikan}$ said, is given by:

\begin{align} &1\pars{1 - a}\pars{1 - 4a}\pars{1 - 9a}\ldots\bracks{1 - \pars{n - 1}^{2}a} = \prod_{k = 0}^{n - 1}\pars{1 - k^{2}a} = \prod_{k = 1}^{n - 1}\pars{1 - k^{2}a} \\[5mm] = &\ \pars{-1}^{n - 1}a^{n - 1}\prod_{k = 1}^{n - 1}\pars{k^{2} - {1 \over a}} = \pars{-1}^{n - 1}a^{n - 1} \bracks{\prod_{k = 1}^{n - 1}\pars{k - {1 \over \root{a}}}} \bracks{\prod_{k = 1}^{n - 1}\pars{k + {1 \over \root{a}}}} \\[5mm] = &\ \pars{-1}^{n - 1}a^{n - 1} \pars{1 - {1 \over \root{a}}}^{\overline{n -1}} \pars{1 + {1 \over \root{a}}}^{\overline{n - 1}} \\[5mm] = &\ \pars{-1}^{n - 1}a^{n - 1}\,{\Gamma\pars{1 - 1/\root{a} + n - 1} \over \Gamma\pars{1 - 1/\root{a}}}\, {\Gamma\pars{1 + 1/\root{a} + n - 1} \over \Gamma\pars{1 + 1/\root{a}}} \\[1cm] = &\ \pars{-1}^{n - 1}a^{n - 1}\,{1 \over \Gamma\pars{1 - 1/\root{a}}} \,{1 \over \pars{1/\root{a}}\Gamma\pars{1/\root{a}}}\, \Gamma\pars{n + {1 \over \root{a}}}\times \\[2mm] &\ {\pi \over \Gamma\pars{1 - n + 1/\root{a}}\sin\pars{\pi\bracks{n - 1/\root{a}}}} \\[1cm] = &\ \pars{-1}^{n - 1}a^{n - 1}\,{\sin\pars{\pi/\root{a}} \over \pi/\root{a}}\, \Gamma\pars{n + {1 \over \root{a}}}\, {\pi \over \Gamma\pars{1 - n + 1/\root{a}}\pars{-1}^{n + 1}\sin\pars{\pi/\root{a}}} \\[5mm] = &\ a^{n - 1/2}\, {\Gamma\pars{n + 1/\root{a}} \over \Gamma\pars{1 - n + 1/\root{a}}} = {a^{n} \over \root{a}}\, {\Gamma\pars{n + 1/\root{a}} \over \pars{- n + 1/\root{a}} \Gamma\pars{-n + 1/\root{a}}} \\[5mm] = & \bbox[15px,#ffe,border:1px dotted navy]{\ds{{a^{n} \over 1 - n\root{a}}\, {\Gamma\pars{1/\root{a} + n} \over \Gamma\pars{1/\root{a} - n}}}} \qquad \mbox{with}\quad a\pars{n - 1}^{2} < 1 \iff \left\{\begin{array}{rcl} \ds{a} & \ds{<} & \ds{1 \over \pars{n - 1}^{2}} \\[2mm] \ds{n} & \ds{\le} & \ds{\left\lfloor\,{1 + {1 \over \root{a}}}\,\right\rfloor} \end{array}\right. \end{align}

The "chance of surviving the first $\ds{80}$ years", as $\texttt{@Ross Millikan}$ said, is $\ds{1/2}$ provided

$$ {a^{80} \over 1 - 80\root{a}}\, {\Gamma\pars{1/\root{a} + 80} \over \Gamma\pars{1/\root{a} - 80}} = {1 \over 2} \implies a \approx 4.11 \times 10^{-6} $$

We can improve this approximation by using a numerical method. For instance, the Bisection one, in the interval $\ds{\bracks{4.10 \times 10^{-6},4.11 \times 10^{-6}}}$.

5
On

This is not an answer but it is too long for a comment.

Using Felix Marin's beautiful answer and assuming that $a$ is a small number, the expansion of $$A=\log \left(\frac{a^n \Gamma \left(\frac{1}{\sqrt{a}}+n\right)}{\left(1-\sqrt{a} n\right) \Gamma \left(\frac{1}{\sqrt{a}}-n\right)}\right)$$ is given by

$$A=-\frac{n(n-1) (2 n-1)}{6} \,a \left(1+\frac{3 n^2-3 n-1}{10}\, a+\frac{3 n^4-6 n^3+3 n+1}{21}\,a^2 \right)+O(a^4)$$

Using $n=80$, $A=-\log(2)$ and solving for $a$ :

  1. Using the first order leads to $a=\frac{\log (2)}{167480}\approx 4.13869\times 10^{-6}$
  2. Adding the next term leads to $a \approx 4.10671\times 10^{-6}$
  3. Adding the next term leads to $a \approx 4.10632\times 10^{-6}$ which is the exact solution for six significant figures.

Update

Using the expansion given above requires solving polynomials. We can do better expanding function $$f(a)=\log \left(\frac{a^n \Gamma \left(\frac{1}{\sqrt{a}}+n\right)}{\left(1-\sqrt{a} n\right) \Gamma \left(\frac{1}{\sqrt{a}}-n\right)}\right)-b$$ as a Taylor series and perform series reversion. This will give $$a =X+\frac{1}{10} \left(-3 n^2+3 n+1\right) X^2+\frac{\left(39 n^4-78 n^3+63 n^2-24 n-29\right) }{1050}X^3+\frac{\left(-17 n^6+51 n^5+16 n^4-117 n^3-152 n^2+219 n+131\right)}{4200} X^4+\cdots $$ where $$X= -\frac{6 b}{2 n^3-3 n^2+n}$$Applied to the test case $n=80$, $b=-\log(2)$ this gives $a \approx 4.10632\times 10^{-6}$