:

## MathematicalFunctions:-Sequences

Symbolic sequences enter in various formulations in mathematics. This post is about a related new subpackage, Sequences, within the MathematicalFunctions package, available for download in Maplesoft's R&D page for Mathematical Functions and Differential Equations (currently bundled with updates to the Physics package).

Perhaps the most typical cases of symbolic sequences are:

1) A sequence of numbers - say from n to m - frequently displayed as

2) A sequence of one object, say a, repeated say p times, frequently displayed as

3) A more general sequence, as in 1), but of different objects and not necessarily numbers, frequently displayed as

or likewise a sequence of functions

In all these cases, of course, none of n, m, or p are known: they are just symbols, or algebraic expressions, representing integer values.

These most typical cases of symbolic sequences have been implemented in Maple since day 1 using the `\$` operator. Cases 1), 2) and 3) above are respectively entered as , , and  or  To have computer algebra representations for all these symbolic sequences is something wonderful, I would say unique in Maple.

Until recently, however, the typesetting of these symbolic sequences was frankly poor, input like  or ` just being echoed in the display. More relevant: too little could be done with these objects; the rest of Maple didn't know how to add, multiply, differentiate or map an operation over the elements of the sequence, nor for instance count the sequence's number of elements.

All this has now been implemented.  What follows is a brief illustration.

 >

First of all, now these three types of sequences have textbook-like typesetting:

 >
 (1)
 >
 (2)

For the above, a\$p works the same way

 >
 (3)

Moreover, this now permits textbook display of mathematical functions that depend on sequences of paramateters, for example:

 >
 (4)
 >
 (5)

More interestingly, these new developments now permit differentiating these functions even when their arguments are symbolic sequences, and displaying the result as in textbooks, with copy and paste working properly, for instance

 >
 (6)

It is very interesting how much this enhances the representation capabilities; to mention but one, this makes 100% possible the implementation of the Faa-di-Bruno  formula for the nth symbolic derivative of composite functions (more on this in a post to follow this one).

But the bread-and-butter first: the new package for handling sequences is

 >
 (7)

The five commands that got loaded do what their name tells. Consider for instance the first kind of sequences mentione above, i.e

 >
 (8)

Check what is behind this nice typesetting

 >
 `\$`(n .. m)

All OK. How many operands (an abstract version of Maple's nops  command):

 >
 (9)

That was easy, ok. Add the sequence

 >
 (10)

Multiply the sequence

 >
 (11)

Map an operation over the elements of the sequence

 >
 (12)
 >
 `\$`(f(j), j = n .. m)

Map works as map, i.e. you can map extra arguments as well

 >
 (13)

All this works the same way with symbolic sequences of forms  , and . For example:

 >
 (14)
 >
 `\$`(a, p)
 >
 (15)
 >
 (16)
 >
 (17)

Differentation also works

 >
 (18)
 >
 (19)
 >
 (20)

For a symbolic sequence of type 3)

 >
 (21)
 >
 (22)
 >
 (23)
 >
 (24)

The following is nontrivial: differentiating the sequence , with respect to  should return 1 when  (i.e the running index has the value k), and 0 otherwise, and the same regarding m and k. That is how it works now:

 >
 (25)
 >
 `\$`(piecewise(k = i, 1, 0), i = n .. m)
 >
 (26)
 >
 (27)
 >
 `\$`((diff(f(a[i]), a[i]))*piecewise(k = i, 1, 0), i = n .. m)

And that is it. Summarizing: in addition to the former implementation of symbolic sequences, we now have textbook-like typesetting for them, and more important: Add, Multiply, Differentiate, Map and Nops. :)

The first large application we have been working on taking advantage of this is symbolic differentiation, with very nice results; I will see to summarize them in a post to follow in a couple of days.