Quick tip: Do you prefer typeset output?
If you are using the show(...) command a lot, you might want to try out switching to typeset output.
Challenge
Find an identity with hypergeometric terms (in both and ) and such that does not have a WZ mate.
Loading the packages
You need to first download the wz.py file from our website and make it available to Sage by, for instance, copying it into the directory containing the Sage notebook.
The ore_algebra package is already installed on the SageMathCloud, but needs to otherwise be installed. See http://arxiv.org/abs/1306.4263v1 for more information, including examples, on this package.
When running commands from these below, you will usually see several DeprecationWarning's pop up in red font. To get rid of these, you can run the command again.
Celine's method
Examples from class
Example: .
Example: .
Recall that the sum actually equals . Let's see a few ways to check that.
Before we continue... note the following very common cause of unexpected trouble: n is no longer the variable it used to be.
(When writing for n in [0..5], n was assigned numerical values.)
Exercise
Find a recursion for the sum .
Prove that .
What about the sums for ?
No recursion found if we only allow order 1 for the shift operators.
Increasing either of the orders, we do find recurrences.
Which of these two should we prefer?
Note that we want a recursion for the sum of least possible order (from the answer, we know that there is one of order 1, but Celine's method is not guaranteed to find the one of least order). Therefore, we should increase the order in before increasing the order in . In this example, we succeeded and actually found a first-order recursion for the sum.
From there, we can derive the formula ourselves.
This is again a first order operator, so we can immediately express the sum as a hypergeometric term.
Here is a less inspired way to find the solution. Just to expose some more advanced possibilities...
Can you figure out what is going on?
WZ method
Example: .
Why is it fully expected that we don't find a WZ mate for ?
Example: .
Example: .
This example illustrates that we can work with symbolic parameters.
Exercise
Give a WZ proof of .
Give a WZ proof of .
What about the sums for ?
Gosper's algorithm
Example: sums of powers
Recall what this means: if , then is a discrete antiderivate, that is, .
In particular, .
Exercise
Does have a hypergeometric term discrete antiderivative? What about ?
Evaluate the sum .
Discover the geometric sum.
Determine .
Compute a WZ pair for directly by using Gosper's algorithm.
Simplifying symbolic expressions is not yet one of Sage's strong points...
Let's check that we get the same answer as from WZ:
Why are the rational functions slightly different?
Ore Algebra Basics
Working with derivative operators
Finding power series solutions to differential equations
Just one example of the things we can do. Explore more yourself by going through the properties of operators.
Find all solutions to the Bessel differential equation
This is the Bessel function. Let's compare with the builtin function.
One of the inconsistencies... the following should work, too, but doesn't simplify yet.
The Bessel function is the unique analytic solution the second-order differential equation. Here is the second solution.
Check out the Frobenius method if you are interested in learning how to find all these solutions.
We made x a variable in a polynomial ring over Q. Let's revert it to a symbolic variable before confusing ourselves later on.
Working with shift operators
Playing with the Fibonacci recurrence
Depending on the initial values, we get Fibonacci or Lucas numbers
Guessing recurrences
With only a few values, you can try to guess a recurrence.
Of course, we could have done that by hand, too.
But the guessing works for any sequence, as soon as you have a way to compute sufficiently many terms.
Exercise
In different ways, obtain an operator which annihilates .
Find an operator which annihilates the square of the Fibonacci numbers.
Find an operator which annihilates both and the Fibonacci numbers.
Let's find a recurrence for squares of Fibonacci numbers by guessing.
(This is actually a perfectly rigorous way of finding the recurrence, because we know from class that there has to be a recurrence of order 3 with constant coefficients.)
Here is an advanced alternative:
Conversion between shift and derivative operators
From a recurrence to a differential equation (for the ogf)
From a differential equation to a recurrence
Zeilberger's algorithm
Given a hypergeometric term , Zeilberger's algorithm determines an operator such that for some .
This computation can be certified with a rational function such that .
Exercise
Find a recursion for .
Prove that $$\sum_k \binom{2 k}{k} \binom{2 n - 2 k}{n - k} \binom{n + k}{n - k} \binom{n
k}{k} = \sum_k \binom{n}{k}^4.$$
It only remains to check at least two initial values (note that the leading coefficient in the recurrence doesn't vanish for ).