3
$\begingroup$

Well! I was going through harmonic series from mathworld.worlfram I found harmonic numbers are really tough to calculate I was scribbling and wrote this thing $$\sum_{k = 1}^{x}H_k= \sum_{k =1}^{x}\left(\sum_{u = 1}^{k}\frac 1{u}\right)$$ How can I simplify these highly complicated things Howe can we find this thing At the first, we can't find $H_k$ itself and series over series making it a little hard I wonder how can we simplify this thing? It's just my curiosity....

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Well! then I liked this curiosity

I guess by solving you mean just to find only one harmonic number(say: $H_p)$ and finding the above $\sum\sum\frac 1{k}$

This is possible and I solved that by finding a pattern that only the last terms of each harmonic number are making previously calculated harmonic numbers different with only $\frac 1{k-1}$

But for the sake proof of my simplified result, I can provide an easy way

$$\begin{align*} S &=\sum_{k =1}^{x}H_k\\ &=\sum_{k =1}^{x}\sum_{n =1}^{k}\frac 1{n}\\ &=\sum_{k =1}^{x}\frac 1{n}\sum_{k =n}^{x}1\\ & = \sum_{k =1}^{x}\frac 1{n}(x-n+1)\\ & =\sum_{k =1}^{x}\frac {(x+1)-n}{n}\\ & =(x+1)\sum_{k =1}^{x}\frac 1{n} - \sum_{k =1}^{x}1\\ & = (x+1)H_x - x \end{align*}$$

Python Pr

Here, SH() & test() is our result expected which are equal.

$\endgroup$
8
  • $\begingroup$ Wonderful! Elegant! $\endgroup$
    – user992847
    Commented Nov 14, 2021 at 10:43
  • 1
    $\begingroup$ You can simplify code: sympy.harmonic() $\endgroup$
    – user992847
    Commented Nov 14, 2021 at 11:06
  • $\begingroup$ @HarryJane Thanks! *def test(x): ... ans1 = sum(list(sympy.harmonic(k) for k in range(1, x+1))) ... ans2 = (x+1)*sympy.harmonic(x) - x ... print(bool(ans1==ans2)) $\endgroup$
    – Darshan P.
    Commented Nov 14, 2021 at 11:08
  • $\begingroup$ Would like to know how often do you use sympy module? $\endgroup$
    – user992847
    Commented Nov 14, 2021 at 11:10
  • 1
    $\begingroup$ @HarryJane You are texting an introvert!!!! $\endgroup$
    – Darshan P.
    Commented Nov 14, 2021 at 11:14

You must log in to answer this question.