axiom-developer
[Top][All Lists]

## [Axiom-developer] Re: [Axiom Algebra] Layers 22 & 23 missing

 From: Martin Rubey Subject: [Axiom-developer] Re: [Axiom Algebra] Layers 22 & 23 missing Date: Sat, 23 Oct 2004 14:52:39 +0200

```Dear Camm,

Regarding the organisation of the summation algorithms: There are currently two
different ways summation algos are called: The package SUMFS FunctionSpaceSum
looks whether Gosper's algo is applicable, if yes, tries it, and if Gosper
succeeds returns the reult. If Gosper is not applicable or fails -- the latter
is the case for sum(1/k,k=0..n) for example -- it falls back to summation\$COMBF
which returns
%defsum[summands,dummy_variable,summation_variable,lower_bound,upper_bound].

SUMFS sits in Layer 20, however, I don't know whether this is too interesting.

The package SUMRF RationalFunctionSum (Layer 14, for what its worth) invokes
Gosper for rational functions. (SUMFS does some normalizing first)

The second way summation can be invoked is through the operators %defsum (for
definite summations) and summation (for indefinite summations - no % here...)

The lines

evaluate(opsum, isum)
evaluate(opdsum, iidsum)

in COMBF tell Axiom to use isum\$COMBF and iidsum\$COMBF to evaluate these
operators. I.e., when Axiom is told to evaluate such an operator, it goes
there. However, in this case, it does not check whether it could apply
Gosper...

The only thing iidsum does is to check whether the bounds are numbers or
not. If yes, it adds the summands, otherwise it calls idsum.

The statements in COMBF

idsum l ==
member?(retract(second l)@SE, variables first l) =>
kernel(opdsum, l)
first(l) * (fourth rest l - fourth l + 1)

check whether the summands actually contain the summation variable. If yes, the
operator %defsum (opdsum is a variable containing %defsum) is wrapped into a
"kernel", which prevents it from being evaluated again. Otherwise, the obvious
formula applies.

So, the problem occurs if I have an operator %defsum applied to some summand,
but the summand is changed via eval or subst for example. In this case,
sum\$SUMFS won't be called, since Axiom doesn't see a function but an
operator. Instead, iidsum will be called -- since the evaluate line tells Axiom
so...

I don't think that this is horribly difficult to fix, but there should be a
clear design, leaving the possibility to integrate other summation algos.

-----------------

A second remark: Note that Zeilbergers Algo does not return a "closed form"
for the sum. It returns a reccurence relation. At the moment, there is no
notion for such a thing in Axiom. For my guessing package (which will return
reccurence relation at times, too), I simply defined an operator

oprecur := operator("rootof"::Symbol)\$CommonOperators

which works for the moment. If somebody is interested, he should think about
programming a recurrence solver...

Have fun,

Martin

```