Below I'll show three ways to utilize a generated rule for substitution, to attain the goal. One uses simplify
, one uses applyrule
, and one uses subs
.
Firstly, Maple can convert harmonic(z)
to sum form, but the reverse operation needs help. I'll construct an equation for use in substitution, from what Maple does actually compute for the value
of the Sum
form of harmonic(z)
.
restart;
convert(harmonic(b), Sum):
Sum(b/_k1/(_k1+b),_k1 = 1 .. infinity)
value(%);
gamma + Psi(1 + b)
So let's construct a formula to utilize,
T1 := expand(value(convert(harmonic(z),Sum)) = harmonic(z));
1
T1 := Psi(z) + - + gamma = harmonic(z)
z
Performing only the inner summation,
Q1 := Sum(sum(1/k, k=1..b), b=1..m);
Sum(gamma+Psi(1+b),b = 1 .. m)
We can now simplify
with T1
as a so-called "side-relation", after substituting z
for b
in Q1
,
simplify(subs(b=z, combine(expand(Q1))), {T1});
Sum(harmonic(z),z = 1 .. m)
At which point Maple does the following,
value(%);
harmonic(m + 1) (m + 1) - m - 1
Alternatively we can put T1
in a slightly different form, isolating for Psi(z)
,
T2 := isolate(T1, Psi(z));
1
T2 := Psi(z) = harmonic(z) - gamma - -
z
Now take the double summation,
temp := sum(sum(1/k, k=1..b), b=1..m):
Q2 := simplify(expand(temp),size);
/ 2 \ 2
\m + m/ Psi(m) + 1 + (gamma - 1) m + (gamma + 1) m
Q2 := ----------------------------------------------------
m
And we can construct a rule from T2
, for use with the applyrule
command. This does not entail substituting m
for z
.
R := subs(Psi(z)=Psi(z::anything), T2):
normal(applyrule(R, Q2));
harmonic(m) m + harmonic(m) - m
There are other ways to use T2
to substitute for Psi(z)
. By first substituting m
for z
in T2
we can use subs
directly.
normal(subs(subs(z=m, T2), Q2));
harmonic(m) m + harmonic(m) - m