Example: Bernoulli Polynomials and Sums of Powers
Axiom provides operations for computing definite and indefinite sums.
You can compute the sum of the first ten fourth powers by evaluating this.
This creates a list whose entries are m^4 as m ranges from 1 to 10, and then
computes the sum of the entries of that list.
You can also compute a formula for the sum of the first k fourth powers,
where k is an unspecified positive integer.
This formula is valid for any positive integer k. For instance, if we
replace k by 10, we obtain the number we computed earlier.
You can compute a formula for the sum of the first k nth powers in a
similar fashion. Just replace the 4 in the definition of sum4 by any
expression not involving k. Axiom computes these formulas using Bernoulli
polynomials; we use the rest of this section to describe this method.
First consider this function of t and x.
Since the expressions involved get quite large, we tell Axiom to show us only
terms of degree up to 5.
If we look at the Taylor expansion of f(x,t) about t=0, we see that the
coefficients of the powers of t are polynomials in x.
In fact, the nth coefficient in this series is essentiall the nth Bernoulli
polynomial: the nth coefficient of the series is 1/n!*Bn(x), where Bn(x) is
the nth Bernoulli polynomial. Thus, to obtain the nth Bernoulli polynomial,
we multiply the nth coefficient of the series ff by n!. For example, the
sixth Bernoulli polynomial is this.
We derive some properties of the function f(x,t). First we compute
f(x+1,t)-f(x-t).
If we normalize g, we see that it has a particularly simple form.
From this it follows that the nth coefficient in the Taylor expansion of
g(x,t) at t=0 is 1/(n-1)!*x^(n-1). If you want to check this, evaluate the
next expression.
However, since
g(x,t)=f(x+1,t)-f(x,t)
it follows that the nth coefficient
is
1/n! * (Bn(x+1) - Bn(x))
Equating coefficients, we see that
1/(n-1)! * x^(n-1) = 1/n! * (Bn(x+1) - Bn(x))
and, therefore
x^(n-1) = 1/n * (Bn(x+1) - Bn(x))
Let's apply this formula repeatedly, letting x vary between two integers
a and b, with a<b:
a^(n-1) = 1/n * (Bn(a+1) - Bn(a))
(a+1)^(n-1) = 1/n * (Bn(a+2) - Bn(a+1))
(a+2)^(n-1) = 1/n * (Bn(a+3) - Bn(a+2))
.
.
(b-1)^(n-1) = 1/n * (Bn(b) - Bn(b-1))
b^(n-1) = 1/n * (Bn(b+1) - Bn(b))
When we add these equations we find that the sum of the left-hand sides is
sum(m=a..b,m^(n-1))
the sum of the (n-1)-st powers from a to b. The sum
of the right-hand sides is a "telescoping series". After cancellation, the
sum is simply
1/n*(Bn(b+1)-Bn(a))
Replacing n by n+1, we have shown that
sum(m=a..b,m^n) = 1/(n+1)*(B<n+1>(b+1)-B<n+1>(a))
Let's use this to obtain the formula for the sum of fourth powers.
First we obtain the Bernoulli polynomial B5.
To find the sum of the first k 4th powers, we multiply 1/5 by
B5(k+1)-B5(1)
This is the same formula that we obtained via sum(m^4,m=1..k)
At this point you may want to do the same computation, but with an exponent
other than 4. For example, you might try to find a formula for the sum of
the first k 20th powers.