# The present script will test that redct has been installed properly and can
# be used as an example to treat other integrals. Run this using (on a Unix
# platform)
# maple -b
-B
# where is the directory where the files have been installed.
# (Tested 2018/11/21 with Maple2017 and Maple2018.)
# The script will stop on error if any of the ASSERTs below detects a problem.
kernelopts(assertlevel = 1):
interface(errorbreak = 2):
read "redct.mpl";
ASSERT(assigned(GB_to_matrices), "source files cannot be loaded");
# Example of the paper.
f := exp(-p*x) * ChebyshevT(n,x) / sqrt(1-x^2):
# New creative-telescoping algorithm, based on generalized Hermite reduction.
time(assign(
ghred_ct = redct(Int(f, x = -1..1), [n::shift, p::diff])));
ghred_ct;
ASSERT(assigned(ghred_ct), "reduction-based algorithm did not work");
# For comparison sake, old creative-telescoping algorithm, based on rational
# LODE solving.
with(Mgfun):
time(assign(
ratsol_ct = creative_telescoping(f, [n::shift, p::diff], x::diff)));
ratsol_ct;
ASSERT(assigned(ratsol_ct), "rational-solving-based algorithm did not work");
# Both implementations rely on the following generation of equations.
time(assign(
sys = dfinite_expr_to_sys(f, y(n::shift, p::diff, x::diff))));
sys;
# Mgfun:-creative_telescoping has returned pairs [q[1], q[2]] satisfying
# q[1] = diff(q[2], x).
# Check the obtained telescopers (q[1]) by using the certificates (q[2]):
map(q -> q[1] - diff(q[2], x),
eval(ratsol_ct, {_F = unapply(f, n, p), _f = unapply(f, n, p, x)}));
simplify(subs(n = 10, %));
ASSERT(% = [0, 0], "bug in creative_telescoping");
# redct has obtained the same telescopers as creative_telescoping:
ratsol_telescopers := map(q -> q[1], ratsol_ct);
ghred_telescopers := map(Ore_algebra:-applyopr, ghred_ct, _F(n, p),
Ore_algebra:-skew_algebra(shift = [D[n], n], diff = [D[p], p]));
ASSERT(ratsol_telescopers = ghred_telescopers, "equations differ (are they equivalent?)");
print("All is fine.");