14.10.5 Special examples

In this section we illustrate calculations that would be awkward to do (as far as I know) in non-symbolic computer algebra systems like MAGMA or GAP.

We compute the gcd of $ 2x^{n+4} - x^{n+2}$ and $ 4x^{n+1} + 3x^n$ for arbitrary $ n$ .

sage: f = maxima('2*x^(n+4) - x^(n+2)')
sage: g = maxima('4*x^(n+1) + 3*x^n')
sage: f.gcd(g)
x^n

You can plot 3d graphs (via gnuplot):

sage: maxima('plot3d(x^2-y^2, [x,-2,2], [y,-2,2], [grid,12,12])')  # not tested
[displays a 3 dimensional graph]

You can formally evaluate sums (note the nusum command):

sage: S = maxima('nusum(exp(1+2*i/n),i,1,n)')
sage: print S
                        2/n + 3                   2/n + 1
                      %e                        %e
               ----------------------- - -----------------------
                  1/n         1/n           1/n         1/n
               (%e    - 1) (%e    + 1)   (%e    - 1) (%e    + 1)

We formally compute the limit as $ n\to\infty$ of $ 2S/n$ as follows:

sage: T = S*maxima('2/n')
sage: T.tlimit('n','inf')
%e^3-%e

See About this document... for information on suggesting changes.