MathematicalFunctions[Sequences]

 add the elements of a sequence or add to the elements of a symbolic sequence
 Differentiate
 differentiate the elements of a symbolic sequence
 Map
 map an operation to the elements of a symbolic sequence
 Multiply
 multiply the elements of a sequence or multiply to the elements of a symbolic sequence
 Nops
 count the elements of a symbolic sequence

 Calling Sequence Add(S) Differentiate(S, t) Map(P, S) Multiply(S) Nops(S)

Parameters

 S - sequence t - variable name P - procedure or function

Description

 • The Add, Differentiate, Map, Multiply, and Nops commands perform operations on the three kinds of symbolic sequences implemented in the Maple system, namely:
 1.  A sequence of numbers - say from n to m - frequently displayed as

$n,\mathrm{...},m$

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

$\underset{}{\underset{⏟}{a,\mathrm{...},a}}$

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

${a}_{n},\mathrm{...},{a}_{m}$

 or likewise a sequence of functions $f\left(n\right),\mathrm{...},f\left(m\right)$. In all these cases, none of n, m, or p are known: they are just symbols, or algebraic expressions, representing integer values. These symbolic sequences are represented in Maple using the $operator. To cases 1., 2. and 3. correspond, respectively, the input$(n .. m), a $p and a[i]$ (i = n .. m).
 • Add and Multiply can either add or multiply the elements of a symbolic sequence (that is, receive only one operand), as well as add or multiply many elements, where possibly more than one is a symbolic sequence.
 • Nops generalizes nops in that if the single argument is a symbolic sequence, it returns the number of elements it contains expressed in terms of the symbols representing integers that define the sequence.
 • Differentiate and Map respectively generalize diff and map in that they work the same way as the lowercase commands, but when the first argumen,t in the case of Differentiate, or the second argument in the case of Map, is a symbolic sequence, the operation is applied in such a way that the result represents the operation applied to all the elements of the sequence.

Examples

 > $\mathrm{with}\left(\mathrm{MathematicalFunctions}:-\mathrm{Sequences}\right)$
 $\left[{\mathrm{Add}}{,}{\mathrm{Differentiate}}{,}{\mathrm{Map}}{,}{\mathrm{Multiply}}{,}{\mathrm{Nops}}\right]$ (1)

To display symbolic sequences as in textbooks use extended typesetting:

 > $\mathrm{interface}\left(\mathrm{typesetting}=\mathrm{extended}\right):$

Consider now the three forms of symbolic sequences mentioned in the Description:

 > $\mathrm{S__1}≔\mathrm{}\left(n..m\right)$
 $\mathrm{S__1}{≔}{\mathrm{}}{}\left({n}{..}{m}\right)$ (2)
 > $\mathrm{S__2}≔\mathrm{}\left(a,p\right)$
 $\mathrm{S__2}{≔}{a}{$}{p}$ (3)  > $\mathrm{S__3}≔\mathrm{}\left(a\left[i\right],i=n..m\right)$  $\mathrm{S__3}{≔}{{a}}_{{i}}{$}\left({i}{=}{n}{..}{m}\right)$ (4)

The number of operands of these sequences

 > $\mathrm{Nops}\left(\mathrm{S__1}\right)$
 ${m}{-}{n}{+}{1}$ (5)
 > $\mathrm{Nops}\left(\mathrm{S__2}\right)$
 ${p}$ (6)
 > $\mathrm{Nops}\left(\mathrm{S__3}\right)$
 ${m}{-}{n}{+}{1}$ (7)

Add the elements of these sequences

 > $\mathrm{Add}\left(\mathrm{S__1}\right)$
 $\frac{\left({m}{-}{n}{+}{1}\right){}\left({n}{+}{m}\right)}{{2}}$ (8)
 > $\mathrm{Add}\left(\mathrm{S__2}\right)$
 ${a}{}{p}$ (9)
 > $\mathrm{Add}\left(\mathrm{S__3}\right)$
 ${\sum }_{{i}{=}{n}}^{{m}}{}{{a}}_{{i}}$ (10)

Multiply the elements of these sequences

 > $\mathrm{Multiply}\left(\mathrm{S__1}\right)$
 $\frac{{m}{!}}{\left({n}{-}{1}\right){!}}$ (11)
 > $\mathrm{Multiply}\left(\mathrm{S__2}\right)$
 ${{a}}^{{p}}$ (12)
 > $\mathrm{Multiply}\left(\mathrm{S__3}\right)$
 ${\prod }_{{i}{=}{n}}^{{m}}{}{{a}}_{{i}}$ (13)

Differentiate works as diff. For the sequence of numbers ${S}_{1}$, the derivative with respect to anything is 0 and there are $m-n+1$ of them

 > $\mathrm{Differentiate}\left(\mathrm{S__1},k\right)$
 ${0}{$}{m}{-}{n}{+}{1}$ (14) For the sequences of algebraic expressions ${S}_{2}$ and ${S}_{3}$,  > $\mathrm{Differentiate}\left(\mathrm{S__2},a\right)$  ${1}{$}{p}$ (15)
 > $\mathrm{Differentiate}\left(\mathrm{S__3},a\left[k\right]\right)$
 ${\mathrm{PIECEWISE}}{}\left(\left[{1}{,}{k}{=}{i}\right]{,}\left[{0}{,}{\mathrm{otherwise}}\right]\right){$}\left({i}{=}{n}{..}{m}\right)$ (16) Map an operation, say $f$, over the elements of ${S}_{1}$  > $\mathrm{Map}\left(f,\mathrm{S__1}\right)$  ${f}{}\left({j}\right){$}\left({j}{=}{n}{..}{m}\right)$ (17)

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

 > $\mathrm{Map}\left(\mathrm{Int},\mathrm{S__1},x\right)$
 ${\mathrm{Int}}{}\left({j}{,}{x}\right){$}\left({j}{=}{n}{..}{m}\right)$ (18) Map is also useful to add to the elements of a sequence, or multiply each of them  > $\mathrm{Map}\left(\mathrm{+},\mathrm{S__3},r\right)$  ${{a}}_{{i}}{+}{r}{$}\left({i}{=}{n}{..}{m}\right)$ (19)
 > $\mathrm{Map}\left(\mathrm{*},\mathrm{S__2},r\right)$
 ${a}{}{r}{\$}{p}$ (20)
 > 

Compatibility

 • The MathematicalFunctions[Sequences][Add], MathematicalFunctions[Sequences][Differentiate], MathematicalFunctions[Sequences][Map], MathematicalFunctions[Sequences][Multiply] and MathematicalFunctions[Sequences][Nops] commands were introduced in Maple 2016.