Mathematica Asked on March 23, 2021
I know that the following equation, as a function of $s$, has two real roots:
$$
sum_{n=1}^{infty}e^{s(1-s)H[n]}=frac{1-r}{r}e^{s^2}-1
$$
for $0<r<1$. Is there any simple way to find these real roots for a given $r$? Mathematica
takes a long long time to solve it using NSolve, FindRoot, etc. Even worse, for example:
r = 0.8;
FindRoot[(Exp[s^2] (1 - r))/r - 1 == Sum[Exp[s (1 - s) HarmonicNumber[n]], {n, 1, Infinity}], {s, 1.6}]
gives "the sum diverges" which does not.
Using this Math.SE solution to construct a fast approximation of $f(x)=sum_{n=1}^{infty} e^{xcdot H_n}$ as $$ f(x) approx f_m(x) = sum_{n=1}^m e^{xcdot H_n} + sum_{n=m+1}^{infty} e^{xcdot[gamma+log(n)]} = sum_{n=1}^m e^{xcdot H_n} + e^{gamma x}zeta(-x,m+1) $$ for a large integer $m$:
f[x_ /; x < -1, m_Integer /; m >= 1] :=
Total[Exp[Accumulate[x/Range[m]]]] +
Exp[EulerGamma*x]*HurwitzZeta[-x, m + 1]
we can find the desired roots very fast and accurately:
With[{r = 0.8, m = 10^4},
FindRoot[f[s*(1-s), m] == (1-r)/r*Exp[s^2] - 1, {s, -1}]]
(* {s -> -1.2183} *)
With[{r = 0.8, m = 10^4},
FindRoot[f[s*(1-s), m] == (1-r)/r*Exp[s^2] - 1, {s, 1.7}]]
(* {s -> 1.68535} *)
Correct answer by Roman on March 23, 2021
SumConvergence
indicates you sum converges for s
greater than the Golden Ratio, which s = 1.6
is not. Use a slightly larger initial value for FindRoot
:
r = 0.8;
sol = FindRoot[(Exp[s^2] (1 - r))/r - 1 ==
Sum[Exp[s (1 - s) HarmonicNumber[n]], {n, 1, ∞}],
{s, 2}]
(* {s -> 1.68535} *)
FindRoot
now seems to find a root:
N[
(Exp[s^2] (1 - r))/r - 1 -
Sum[Exp[s (1 - s) HarmonicNumber[n]], {n, 1, ∞}] /. sol
]
(* 9.76996*10^-15 *)
The other root, which @user64494 kindly pointed out, occurs in the other interval of convergence, where s
is less than the conjugate of the golden section.
sol = FindRoot[(Exp[s^2] (1 - r))/r - 1 ==
Sum[Exp[s (1 - s) HarmonicNumber[n]], {n, 1, ∞}],
{s, -1}]
(* {s -> -1.2183} *)
Answered by Michael E2 on March 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP