## Maxima – 164 – Somme, prodotti e serie – 1 Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.493.

Funzioni e variabili per somme e prodotti

`bashindices (expr)`
Transforms the expression `expr` by giving each summation and product a unique index. This gives `changevar` greater precision when it is working with summations or products. The form of the unique index is `jnumber`. The quantity `number` is determined by referring to `gensumnum`, which can be changed by the user. For example, `gensumnum:0\$` resets it.

`lsum (expr, x, L)`
Represents the sum of `expr` for each element `x` in `L`. A noun form `'lsum` is returned if the argument `L` does not evaluate to a list.

``````(%i1) lsum (x^i, i, [1, 2, 7]);
7    2
(%o1)                             x  + x  + x
(%i2) lsum (i^2, i, rootsof (x^3 - 1, x));
====
\      2
(%o2)                       >    i
/
====
3
i in rootsof(x  - 1, x)``````

`intosum (expr)`
Moves multiplicative factors outside a summation to inside. If the index is used in the outside expression, then the function tries to find a reasonable index, the same as it does for `sumcontract`. This is essentially the reverse idea of the outative property of summations, but note that it does not remove this property, it only bypasses it.

In some cases, a `scanmap (multthru, expr)` may be necessary before the `intosum`.

`simpproduct`
Default value: `false`.

When `simpproduct` is `true`, the result of a product is simplified. This simplification may sometimes be able to produce a closed form. If `simpproduct` is `false` or if the quoted form `'product` is used, the value is a product noun form which is a representation of the pi notation used in mathematics.

`product (expr, i, i_0, i_1)`
Represents a product of the values of `expr` as the index `i` varies from `i_0` to `i_1`. The noun form `'product` is displayed as an uppercase letter pi.

`product` evaluates `expr` and lower and upper limits `i_0` and `i_1`, `product` quotes (does not evaluate) the index `i`.

If the upper and lower limits differ by an integer, `expr` is evaluated for each value of the index `i`, and the result is an explicit product.

Otherwise, the range of the index is indefinite. Some rules are applied to simplify the product. When the global variable `simpproduct` is true, additional rules are applied.

In some cases, simplification yields a result which is not a product; otherwise, the
result is a noun form `'product`.

See also `nouns` and `evflag`.

``````(%i3) product (x + i*(i+1)/2, i, 1, 4);
(%o3)                  (x + 1) (x + 3) (x + 6) (x + 10)
(%i4) product (i^2, i, 1, 7);
(%o4)                              25401600
(%i5) product (a[i], i, 1, 7);
(%o5)                        a  a  a  a  a  a  a
1  2  3  4  5  6  7
(%i6) product (a(i), i, 1, 7);
(%o6)                 a(1) a(2) a(3) a(4) a(5) a(6) a(7)
(%i7) product (a(i), i, 1, n);
n
/===\
! !
(%o7)                              ! !  a(i)
! !
i = 1
(%i8) product (k, k, 1, n);
n
/===\
! !
(%o8)                                ! !  k
! !
k = 1
(%i9) product (k, k, 1, n), simpproduct;
(%o9)                                 n!
(%i10) product (integrate (x^k, x, 0, 1), k, 1, n);
n
/===\
! !    1
(%o10)                             ! !  -----
! !  k + 1
k = 1
(%i11) product (if k <= 5 then a^k else b^k, k, 1, 10);
15  40
(%o11)                              a   b``````

`simpsum`
Default value: `false`.

When `simpsum` is `true`, the result of a sum is simplified. This simplification may sometimes be able to produce a closed form. If `simpsum` is `false` or if the quoted form `'sum` is used, the value is a sum noun form which is a representation of the sigma notation used in mathematics.

`sum (expr, i, i_0, i_1)`
Represents a summation of the values of `expr` as the index `i` varies from `i_0` to `i_1`.

The noun form ‘sum is displayed as an uppercase letter sigma.

`sum` evaluates its summand `expr` and lower and upper limits `i_0` and `i_1`, `sum` quotes (does not evaluate) the index `i`.

If the upper and lower limits differ by an integer, the summand `expr` is evaluated for each value of the summation index `i`, and the result is an explicit sum.

Otherwise, the range of the index is indefinite. Some rules are applied to simplify the summation. When the global variable `simpsum` is `true`, additional rules are applied.

In some cases, simplification yields a result which is not a summation; otherwise, the result is a noun form `'sum`.

When the `evflag` (evaluation flag) `cauchysum` is `true`, a product of summations is expressed as a Cauchy product, in which the index of the inner summation is a function of the index of the outer one, rather than varying independently.

The global variable `genindex` is the alphabetic prefix used to generate the next index of summation, when an automatically generated index is needed.

`gensumnum` is the numeric suffix used to generate the next index of summation, when an automatically generated index is needed. When `gensumnum` is `false`, an automatically-generated index is only `genindex` with no numeric suffix.

See also `lsum`, `sumcontract`, `intosum`, `bashindices`, `niceindices`, `nouns`, `evflag`, and `zeilberger-pkg`.

``````(%i12) sum (i^2, i, 1, 7);
(%o12)                                140
(%i13) sum (a[i], i, 1, 7);
(%o13)                 a  + a  + a  + a  + a  + a  + a
7    6    5    4    3    2    1
(%i14) sum (a(i), i, 1, 7);
(%o14)          a(7) + a(6) + a(5) + a(4) + a(3) + a(2) + a(1)
(%i15) sum (a(i), i, 1, n);
n
====
\
(%o15)                             >    a(i)
/
====
i = 1
(%i16) sum (2^i + i^2, i, 0, n);
n
====
\       i    2
(%o16)                           >    (2  + i )
/
====
i = 0
(%i17) sum (2^i + i^2, i, 0, n), simpsum;
3      2
n + 1   2 n  + 3 n  + n
(%o17)                   2      + --------------- - 1
6
(%i18) sum (1/3^i, i, 1, inf);
inf
====
\     1
(%o18)                              >    --
/      i
====  3
i = 1
(%i19) sum (1/3^i, i, 1, inf), simpsum;
1
(%o19)                                 -
2
(%i20) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf);
inf
====
\     1
(%o20)                            30  >    --
/      2
====  i
i = 1
(%i21) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf), simpsum;
2
(%o21)                              5 %pi
(%i22) sum (integrate (x^k, x, 0, 1), k, 1, n);
n
====
\       1
(%o22)                             >    -----
/     k + 1
====
k = 1
(%i23) sum (if k <= 5 then a^k else b^k, k, 1, 10);
10    9    8    7    6    5    4    3    2
(%o23)          b   + b  + b  + b  + b  + a  + a  + a  + a  + a``````

`sumcontract (expr)`
Combines all sums of an addition that have upper and lower bounds that differ by constants. The result is an expression containing one summation for each set of such summations added to all appropriate extra terms that had to be extracted to form this sum. `sumcontract` combines all compatible sums and uses one of the indices from one of the sums if it can, and then try to form a reasonable index if it cannot use any supplied.

It may be necessary to do an `intosum (expr)` before the `sumcontract`.

`sumexpand`
Default value: `false`.

When `sumexpand` is `true`, products of sums and exponentiated sums simplify to nested sums.

See also `cauchysum`.

``````(%i24) sumexpand: true\$

(%i25) sum (f (i), i, 0, m) * sum (g (j), j, 0, n);
m      n
====   ====
\      \
(%o25)                      >      >     f(i1) g(i2)
/      /
====   ====
i1 = 0 i2 = 0
(%i26) sum (f (i), i, 0, m)^2;
m      m
====   ====
\      \
(%o26)                      >      >     f(i3) f(i4)
/      /
====   ====
i3 = 0 i4 = 0``````

Posta un commento o usa questo indirizzo per il trackback.