Expansions for harmonic numbers at general rational arguments n + p/q

In [2]: harmonic(2/S(3))
Out[2]: harmonic(2/3)

In [3]: expand_func(_)
(0, 2, 3)
Out[3]: -log(6) + 2*Sum(log(sin(_k*pi/3))*cos(4*_k*pi/3), (_k, 1, 1)) + sqrt(3)*pi/6 + 3*Sum(1/(3*_k + 2), (_k, 0, 0))

In [4]: pprint(_)
              1                                            0
             ____                                         ____
             ╲                                            ╲
              ╲      ⎛   ⎛k⋅π⎞⎞    ⎛4⋅k⋅π⎞     ___         ╲      1
               ╲  log⎜sin⎜───⎟⎟⋅cos⎜─────⎟   ╲╱ 3 ⋅π        ╲  ───────
-log(6) + 2⋅   ╱     ⎝   ⎝ 3 ⎠⎠    ⎝  3  ⎠ + ─────── + 3⋅   ╱  3⋅k + 2
              ╱                                 6          ╱
             ╱                                            ╱
             ‾‾‾‾                                         ‾‾‾‾
            k = 1                                        k = 0

In [5]: _.doit()
Out[5]: -log(6) - log(sqrt(3)/2) + sqrt(3)*pi/6 + 3/2

In [6]: simplify(_)
Out[6]: log(sqrt(3)/9) + sqrt(3)*pi/6 + 3/2

In [7]: _.n()
Out[7]: 0.758981249114944

In [8]: harmonic(2/S(3))
Out[8]: harmonic(2/3)

In [9]: _.rewrite(polygamma)
Out[9]: -3*log(3)/2 + sqrt(3)*pi/6 + 3/2

In [10]: _.n()
Out[10]: 0.758981249114944