From: monagan@inf.ethz.ch (Michael)
Subject: Maple V Release 2
Keywords: Maple
Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
Date: Tue, 17 Nov 1992 17:58:15 GMT

Second part of whats new in Release 2 ...

New and Enhanced System Facilities
==================================

1: Type declarations for parameters
-----------------------------------
Procedures accept type declarations as illustrated by the following example.
The purpose of this facility is to encourage better type checking by making
it easy to write and efficient.

    proc( a:t ) 
        ....
    end

is equivalent to writing

    proc(a)
        if nargs > 0 and not type(a,'t') then ERROR(message) fi;
        ....
    end

Note, the type checking is not static, it is done when the procedure is called.
The error message generated automatically is illustrated by this example

  > f := proc(n:integer) if n < 0 then 0 else n fi end:
  > f(x);
  Error, f expects its 1st argument, n, to be of type integer, but received x

2: D extended to computation sequences and programs
---------------------------------------------------
The D operator can now compute partial derivatives of functions which are
defined as procedures.  This is known as automatic differentiation.  Consider

  > f := proc(x) local t1,t2;
  >     t1 := x^2;
  >     t2 := sin(x);
  >     3*t1*t2+2*x*t1-x*t2
  > end:
  > # The following computes the derivative of f wrt x, the first argument   
  > D[1](f);

  proc(x) local t1x,t2x,t1,t2;
      t1x := 2*x;
      t1 := x^2;
      t2x := cos(x);
      t2 := sin(x);
      3*t1x*t2+3*t1*t2x+2*t1x*x+2*t1-t2x*x-t2
  end

The reader can check that this really does compute the derivative of f by
verifying that diff(f(x),x) - D(f)(x) = 0.  The advantage of automatic
differentiation is twofold.  Firstly, it is much more efficient, in general, to
represent a function as a program instead of as a formula.  Secondly, it is
more general as functions can have conditional statements and loops.
For example, given the array of the coefficients of a polynomial b,
we can represent the polynomial as a program in Horner form as follows.

  > f := proc(x,b,n) local i,s;
  >     s := 0;
  >     for i from n by -1 to 0 do s := s*x+b[i] od;
  >     s   
  > end:
  > f(x,b,4);
                (((b[4] x + b[3]) x + b[2]) x + b[1]) x + b[0]

  > fx := D[1](f);
  fx := proc(x,b,n)
        local sx,i,s;
            sx := 0;
            s := 0;
            for i from n by -1 to 0 do  sx := sx*x+s; s := s*x+b[i] od;
            sx
        end

3: Program optimization -- optimize extended to computations sequences
----------------------------------------------------------------------
The optimize routine has been extended to optimize Maple procedures.
Currently it does common subexpression optimization on computation sequences,
i.e. procedures with assignment statements to local variables only, e.g.

  > f := proc(x) local t; t := x^2; 3*t*sin(x)+2*x*t-x*sin(x) end:
  > readlib(optimize)(f);
  proc(x) local t,t1; t := x^2; t1 := sin(x); 3*t*t1+2*x*t-x*t1 end

4: Multiple libraries -- readlib takes multiple pathnames
---------------------------------------------------------
Maple automatically reads code from the Maple library using the readlib
function.  The global variable libname specifies where the Maple library is.
This can now be assigned a sequence of names.  E.g. if the user does

  > libname := dir1, libname, dir3;

this means that when readlib(f) is executed, Maple will search for f first
under dir1, and if unsuccessful, it will search under the Maple library,
and if unsuccessful under dir3.  This means users can have their own
development library and have it override the Maple library.

5: Assume facility
------------------
One of the deficiencies of Maple and other systems is in handling problems
which contain symbolic parameters where the result depends on the domain or
range of values that the symbolic parameter(s) takes.  E.g. consider

  > Int( exp(-a*t)*ln(t), t=0..infinity );

                          infinity
                             /
                            |
                            |      exp(- a t) ln(t) dt
                            |
                           /
                           0

The answer to this integral depends on the value of the parameter a.  If a is
real and positive, the answer is finite.  If a is real and non-positive, the
answer is infinite.  How can the user tell Maple that a is real and positive?
The solution adopted in Release 2 is to insist that the user state the
assumption about a, i.e. that a is real and positive as follows

  > assume(a>0);

The result of this assumption is that the variable a has been assigned a new
value which prints as a~ which Maple knows is real (implicitly) and positive.

  > a;
                                       a~

  > about(a);
  Originally a, renamed a~:
    is assumed to be: RealRange(Open(0),infinity)

The assume facility is presently being integrated into Maple, in particular,
Maple can now compute the definite integral above because Maple can determine
that a is positive because signum(a) returns 1.

  > signum(a);
                                       1

  > int( exp(-a*t)*ln(t), t=0..infinity );

                                  ln(a~)   gamma
                                - ------ - -----
                                    a~       a~

  > is(a+1>0);
                                      true

A deficiency of the assume facility is that the user needs to know what to
assume in order to get answers out of facilities like definite integration.
We are presently looking at alternative solutions including prompting the
user for help or returning a solution along with the assumptions made.

6: Automatic complex numeric arithmetic
---------------------------------------
Complex arithmetic in Maple V had to be done with the evalc function.
Now, complex numeric arithmetic is automatic, e.g.

  > (2+I/3)^2;
                                  35/9 + 4/3 I

And complex floating point arithmetic

  > sin( (2.0+I/3)^2 );

                          - 1.378776230 - 1.294704958 I

The evalc function is now used only for exact symbolic expansions e.g.

  > evalc(exp(2+Pi/3*I));
                                                    1/2
                         1/2 exp(2) + 1/2 I exp(2) 3

  > evalc( sqrt(a+I*b) );

        2    2 1/2         1/2                          2    2 1/2         1/2
 (1/2 (a  + b )    + 1/2 a)    + I csgn(b - I a) (1/2 (a  + b )    - 1/2 a)

  > assume(a>0);
  > assume(b>0);
  > evalc(sqrt(a+b*I));

             2     2 1/2          1/2             2     2 1/2          1/2
     (1/2 (a~  + b~ )    + 1/2 a~)    + I (1/2 (a~  + b~ )    - 1/2 a~)

7: Arrow operators now accept if statements
-------------------------------------------
The arrow operators, e.g.  x -> x/(x^2-1);  have been extended to handle
if statements so that they can be used to define piecewise functions.
E.g.  x -> if x < 0 then 0 elif x < 1 then x else 0 fi;

8: I/O facilities and changes
-----------------------------
- printf: output a given expression with format (as in the C
  printf, with the added option of %a for algebraic), and also
  includes the C escapes: \b for backspace, \t for tab, \n for newline, e.g.

  > printf(`n = %d\tvar = %s\tresult = %a\n`, 10, y, 3*y^2+1);
  n = 10  var = y result = 3*y^2+1

- sscanf: decode a string according to a format (inverse of
   printf, identical to the C sscanf function).
- input (tty and read) and output (lprint and save) of numbers in scientific
   E/e notation e.g. 1.2e+3 versus Float(12,2) or 1.2*10^3
- readline: read a line of an arbitrary file and return it as a string
- parse: parse a string into a Maple expression
- readdata: reads a file of numerical data arranged in columns
- output (lprint and save) of powers using ^ instead of **
 
9: Restart facility
-------------------
The restart statement will clear all user and system variables and
reinitialize the kernel, essentially allowing you to start your Maple
session from scratch without having to exit Maple.

10: errorbreak
--------------
Maple has added some user control for how Maple responds on encountering errors
when reading in a file.  This is provided by the interface option errorbreak.
- With interface(errorbreak=0); the entire input file is read and all errors
  that are encountered are displayed.  This was the Maple V behaviour.
- With interface(errorbreak=1); processing stops after the first syntax error
  thus avoiding nonsensical multiple syntax error messages that are often
  consequences of the first one.  This is the new default behaviour.
- With interface(errorbreak=2); processing stops after the first error,
  whatever it is, i.e. syntax (parse time) or semantic (execution) errors.


Algorithmic and Efficiency Improvements
=======================================

1: Integration of rational functions
------------------------------------
The Trager-Rothstein algorithm computes the integral of a rational function
f(x) over a field K as a sum of logs over K(alpha), an algebraic extension
of K of minimial degree.  E.g. consider the following rational function
in Q(x) where note the denominator is irreducible over Q.

  > f := (6*x^5+6*x^2-4*x+8*x^3-4)/(x^6+2*x^3+1-2*x^2);
                               5      2            3
                            6 x  + 6 x  - 4 x + 8 x  - 4
                       f := ----------------------------
                                 6      3          2
                                x  + 2 x  + 1 - 2 x

Applying the Trager-Rothstein algorithm yields the following result

                       -----
                        \              3
      (1 + alpha)        )         ln(x  - alpha x + 1)
                        /
                       -----
                        2
                  (alpha  - 2) = 0

I.e. there are two logs corresponding to two roots +- sqrt(2) of the
polynomial alpha^2-2 = 0.  Hence, Maple gets the following nice result

  > int(f,x);

              1/2      3    1/2                1/2      3    1/2
        (1 + 2   ) ln(x  - 2    x + 1) + (1 - 2   ) ln(x  + 2    x + 1)

The first improvement in Release 2 is in handling coefficient fields which are
function fields, and not just number fields.  I.e. the input rational function
could involve parameters as well as numbers.  This is because of the extension
of evala to handle algebraic functions and not just algebraic numbers.
A second improvement due to Lazard and Trager allows for more efficient
computation of the terms inside the logarithms.  A third improvement by Rioboo
improves the presentation of the result.  An example of the latter is

> f := (x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4);

                                     4      2
                                    x  - 3 x  + 6
                           f := --------------------
                                 6      4      2
                                x  - 5 x  + 5 x  + 4
> int(f,x);

The Trager-Rothstein algorithm (Maple V) obtains this result

       1/2 I ln(x  + I x  - 3 x - 2 I) - 1/2 I ln(x  - I x  - 3 x + 2 I)

Rioboo's algorithm (Release 2) yields this real result which has no new poles

           arctan(- 3/2 x  + 1/2 x  + 1/2 x) + arctan(x ) + arctan(x)

2: Bivariate polynomial Gcd's over Z
------------------------------------
We have implemented the dense modular method of Collins for computing GCDs of
polynomials with in two variables with integer coefficients.  This improves the
efficiency of simplifying rational expressions in two variables.  The method
works by computing many GCDs of polynomials in one variable modulo
different primes and combining these solutions using polynomial interpolation
and the Chinese remainder theorem.  Note, in Maple V, we implemented this
method for univariate polynomials.  Also, this is a dense method. For sparse
polynomials in many variables it is not a good method.  Comparing this with
the default EEZ-GCD algorithm in Maple V, we obtain the following improvement.
We created three dense bivariate polynomials g,a,b each of degree n with
random n digit coefficients and computed the gcd(a*g, b*g).

    n                   10     15      20
    Maple V             65.0   1,877   18,763
    Release 2          10.6   33.7    393.7

3: Factorization over algebraic number fields
---------------------------------------------
We have implemented Lenstra's algorithm for factorization of polynomials over an
algebraic number field.  For some polynomials it runs considerably faster than
the default algorithm.  But it depends very much on the polynomial.

4: Faster numerical evaluation of the arctrig functions
-------------------------------------------------------
The running time of the algorithms used for the numerical evaluation of
exp(x) and ln(x) at high precision is O(n^2 log[2] (n)) for n digits.
This is O(log[2](n)) integer multiplications each of which is O(n^2).
The algorithms for the trig functions sin, cos, tan use repeated argument
reduction to obtain an O(n^(5/2)) algorithm.  The same idea is now used
by the arctrig functions, e.g.

        Digits    arcsin(Pi/4)                arctan(Pi/4)
              Maple V    Release 2        Maple V    Release 2

         500      25       3.0                 23       2.5
        1000     176      11.0                148      11.2
        2000    1245      50.4               1038      45.2

5: Optimized the evaluation of numerical arithmetic
---------------------------------------------------
Evaluation of numerical expressions e.g. n-i+1, 2*n-2*j+2, has been sped up to
avoid the creation of an intermediate data structure.  This is a significant
improvement in the cases of small integers, e.g. array subscript calculations.
Consider these two codes for computing the Fibonacci numbers F(n)

  > F1 := proc(n) if n < 2 then n else F1(n-1)+F1(n-2) fi end;
  > F2 := proc(n) F2(n-1)+F2(n-2) end; F2(0) := 0; F2(1) := 1;

The improvement in the arithmetic that occurs in F(n-1)+F(n-2) yields

                 Maple V          Release 2
         n         F1     F2       F1     F2
        16        1.05   0.73     0.78   0.47
        18        2.73   2.17     2.17   1.32
        20        7.30   5.20     5.92   3.55
        22       20.17  13.45    15.20   8.53

6: Floating point solutions to polynomials
------------------------------------------
We have rewritten the code for computing floating point approximations to roots
of polynomials.  The new code will increase the intermediate precision so that
the roots found are fully accurate, i.e. accurate to 0.6 ulp.  We have
also implemented a routine in the kernel in C to use hardware floating point
arithmetic.  If the roots found using this routine are accurate then the fsolve
routine will execute faster, as illustrated in the following examples.  T(n,x)
is the n'th Chebyshev polynomial of the first kind.  It has all real roots.
F(n,x) is the n'th Fibonacci polynomial which has all complex roots except 0.
The jump in times indicates where hardware precision is no longer sufficient.

                Maple V                 Release 2
        n       T(n,x)  F(n,x)          T(n,x)  F(n,x)
        10      1.68    1.86             0.45    0.23
        20      8.95    11.43            2.17    1.43
        30      FAIL    36.72            6.08    3.47
        40              FAIL            34.22    7.57
        50                              106.2   50.45

7: Character tables for Sn
--------------------------
In computing the character table for S_n the symmetric group on n letters we
are now making use of the conjugate partitions and symmetry in the table.
The improvement is better than a factor of 2 for large n.  Note the table has
dimension p(n) by p(n) where p(n) is the number of partitions of n so requires
exponential space in n to store.
The data here are for computing combinat[character](n)

                Maple V         Release 2
        n
        8         6.6             3.5
        10       26.0            12.6
        12      102.0            43.4
        14      446.8           160.3


New Library Functions
=====================

- AFactor, AFactors: absolute factorization over the complex numbers
- argument: complex argument of a complex number
- assume: for making assumptions about variables
- ceil: ceiling function
- csgn: complex sign
- discont: compute a set of possible discontinuities of an expression
- floor: floor function
- fourier, invfourier: symbolic fourier transform and inverse
- ilog, ilog10: IEEE integer logarithm function
- Indep: test algebraic extensions over Q for independence
- invfunc: table of inverse functions
- is, isgiven: for testing properties against the assume database
- makehelp: for making a Maple help page from a file of text
- maxorder: an integral basis for an algebraic number or function field
- Norm: computes the norm of the algebraic number or function
- Primfield: computes a primitive element over a given algebraic number field
- powmod: computes a(x)^n mod b(x) using binary powering
- ratrecon, Ratrecon: rational function reconstruction (Euclidean algorithm)
- readdata: reads a file of numerical data arranged in columns
- spline: computes a natural cubic spline from a set of data
- split: splits a polynomial into linear factors over its splitting field 
- sqrfree: a square free factorization of a multivariate polynomial
- symmdiff: symmetric difference of sets
- tutorial: on-line tutorial facility
- Trace: computes the trace of the algebraic number or function
- unload: unload a Maple library function


Library Packages
=================

The package mechanism has been extended to support an initialization routine.
The initialization routine should be placed either in the package as the
routine  package[init],  or as the routine `package/init` in the library in
the file `package/init.m`;  This routine is executed by  with(package);
It is up to the initialization routine to decide what to do if it is called
a second time.
Below is a list of the new packages and modifications to existing packages.

1: numapprox (Numerical Approximation Package)
----------------------------------------------
- pade: computes a Pade rational function approximation
- infnorm: compute the (weighted) infinity norm of an approximation
- minimax: compute a (weighted) minimax numerical approximation
- remez: Remez algorithm for minimax rational function approximation
- chebpade: compute a Chebyshev-Pade rational function approximation
- chebyshev: compute a Chebyhev series numerical approximation
- confracform: convert a rational function to a continued fraction
- hornerform: convert a polynomial or rational function to Horner form

The call minimax(f(x),x=a..b,[m,n],w) uses the Remez algorithm to
compute the best minimax rational function with numerator of degree <= m and
denominator of degree <= n (Note: n can be zero meaning a polynomial) to the
function f(x) on the range [a,b].  The optional 4'th paramter w specifies
a weight function (default 1).  For example, here is a [4,3] rational
approximation to erf(x) on [0,3] which we've rounded to 7 decimal digits.
The approximation is accurate to 4 digits on [0,3].

  > evalf(minimax(erf(x),x=0..3,[4,3]), 7);

    - .000088319 + (1.132571 + ( - .4507723 + (.1724417 - .0209750 x) x) x) x
   --------------------------------------------------------------------------
                1. + ( - .3706125 + (.4051100 - .04578747 x) x) x


2: DEtools (Differential Equation Tools Package)
------------------------------------------------
A package for plotting differential equations including systems of ODE's
and some special PDE's, allowing the associated vector field to be plotted
and solution curves for different initial conditions.
- DEplot: plot a single ODE or a system of first order ODEs
- DEplot1: plot a first order ODE
- DEplot2: plot a system of two first order ODEs
- PDEplot: plot the surface of a first order, quasi-linear PDE of the form
  P(x,y,u) * D[1](u)(x,y) + Q(x,y,u) * D[2](u)(x,y) = R(x,y u)
- dfieldplot: plot a field plot for a single or two first order linear ODEs
- phaseportrait: plot a phase plot for a single or two first order linear ODEs

3: Gauss
--------
A package which allows one to create "domains" of computation in a similar way
that the AXIOM system allows.  The advantage is that routines for computing
with polynomials, matrices, and series etc. can be parameterized by any
coefficient ring.  E.g. given a ring R, the Gauss statement

  > P := DenseUnivariatePolynomial(R,x):

creates a dense univariate polynomial domain P which contains all the routines
needed to do arithmetic with polynomials over R.  The advantage is that the
the code supplied by the DenseUnivariatePolynomial function works for any
coefficient domain R which is a ring, i.e. has operations +, -, *, etc.
It is expected that many Maple library routines will be recoded in Gauss over
the next few versions.  The initial implementation includes basic facilities
for computing with polynomials, matrices and series over number rings,
finite fields, polynomial rings, and matrix rings.

4: GaussInt (Gaussian Integer Package)
--------------------------------------
This is a set of routines for computing with Gaussian (complex) integers, i.e.
numbers of the form a + b I where a and b are integers.  Included are routines
for computing the Gcd of two Gaussian integers, the factorization of a Gaussian
integer, and a test for primality, e.g.

  > GIfactor(13);
                              (3 + 2 I) (3 - 2 I)

5: linalg (Linear Algebra Package)
----------------------------------
- blockmatrix: utility routine to create a block matrix
- gausselim, gaussjord, rowspace, colspace: now handle matrices of
  floats, complex floats, and complex rationals
- eigenvals, eigenvects: now handle matrices of floats and complex floats
- entermatrix: utility routine for entering the entries of a matrix
- randvector: utility routine to create a random vector
- ratform: (synonym for frobenius) computes the rational canonical form
- Wronskian: computes the Wronskian matrix

6: numtheory: (Number Theory Package)
-------------------------------------
- cfrac: modified to handle different forms of continued fractions
        real numbers, series, polynomials.
- cfracpol: computes continued fractions for the real roots of a polynomial
- kronecker: Diophantine approximation in the inhomogeneous case
- minkowski: Diophantine approximation in the homogeneous case
- nthnumer: returns the denominator of the n'th convergent
- nthdenom: returns the numerator of the n'th convergent	
- nthconver: returns the n'th convergent of a simple continued fraction
- thue: compute the resolutions of Thue equations or Thue inequalities
- sq2factor: factorization in the UFD Z[sqrt(2)]

7: padic (Padic Number Package)
-------------------------------
A package for computing P-adic approximations to real numbers, e.g.

  > with(padic):
  > evalp(sqrt(2),7);

                      2      3    4      5    6      7      8      9
           3 + 7 + 2 7  + 6 7  + 7  + 2 7  + 7  + 2 7  + 4 7  + O(7 )

  > evalp(exp(3),3);
                            2      3      4    6    8      9
                   1 + 3 + 3  + 2 3  + 2 3  + 3  + 3  + O(3 )

8: plots (Plots Package)
------------------------
- animate: animate one or more functions in 2 dimensions, e.g.
  a) sine - cosine waves
     animate({sin(x*t),cos(x*t)},x=-2*Pi..Pi,t=0..2*Pi);
  b) a polar coordinate unraveling
     animate([sin(x*t),x,x=-4..4],t=1..4,coords=polar,numpoints=100,frames=100);

- animate3d: animate one or more curves or surfaces in 3 dimensions, e.g.
   animate3d(cos(t*x)*sin(t*y), x=-Pi..Pi, y=-Pi..Pi,t=1..2);

- conformal: routine is typically 3 times faster
- contourplot: contour plot of a 3 dimensional surface, e.g.
   contourplot(sin(x*y),x=-Pi..Pi,y=-Pi..Pi,grid=[30,30]);

- densityplot: density plot, e.g.
   densityplot(sin(x*y),x=-Pi..Pi,y=-Pi..Pi,grid=[30,30]);

- fieldplot: plot of a 2 dimensional vector field
   vfield := [x/(x^2+y^2+4)^(1/2),-y/(x^2+y^2+4)^(1/2)]:
   fieldplot(vfield,x=-2..2,y=-2..2);
- fieldplot3d: plot of a 3 dimensional vector field
   fieldplot3d([2*x,2*y,1],x=-1..1,y=-1..1,z=-1..1,
               grid=[10,10,5],arrows=THICK,style=patch);

- gradplot: plot the gradient vector field of a 2 dimensional function
- gradplot3d: plot the gradient vector field of a 3 dimensional function, e.g.
   gradplot3d( (x^2+y^2+z^2+1)^(1/2),x=-2..2,y=-2..2,z=-2..2);

- implicitplot: plot a curve defined implicitly by F(x,y) = 0, e.g.
   implicitplot( x^2 + y^2 = 1, x=-1..1,y=-1..1 );
- implicitplot3d: plot a surface defined implicitly by F(x,y,z) = 0, e.g.
   implicitplot3d( x^2+y^2+z^2 = 1, x=-1..1, y=-1..1, z=-1..1 );

- logplot: log plot, e.g. logplot(10^(20*exp(-x)),x=1..10);
- loglogplot: log log plot, e.g. loglogplot(10^(20*exp(-x)),x=1..100);

- odeplot: plot the solution of an ODE from dsolve
   p := dsolve({D(y)(x) = y(x), y(0)=1}, y(x), numeric):
   odeplot(p,[x,y(x)],-1..1);

- polygonplot: draw one or more polygons in 2 dimensions
   ngon := n -> [seq([ cos(2*Pi*i/n), sin(2*Pi*i/n) ], i = 1..n)]:
   polygonplot(ngon(8));
- polygonplot3d: draw one or more polygons in 3 dimensions

- polyhedraplot: for plotting tetrahedrons, octahedrons, hexahedrons,
     dodecahedrons, icosahedrons e.g.
   polyhedraplot([0,0,0],polytype=dodecahedron);

- surfdata: plot a surface input as a grid of data points
   cosdata := [seq([ seq([i,j,evalf(cos((i+j)/5))], i=-5..5)], j=-5..5)]:
   F := (x,y) -> x^2 + y^2:
   surfdata( cosdata, axes=frame, color=F );

- textplot: for plotting labelled points in 2 dimensions, e.g.
   textplot([1,2,`one point in 2d`],align={ABOVE,RIGHT});
- textplot3d: for plotting labelled points in 3 dimensions, e.g.
   textplot3d({[1,2,3,`one point in 3d`],[3,2,1,`second point in 3d`]});

9: networks: (Graph Networks Package)
-------------------------------------
A package of routines for creating, manipulating and computing properties of
graphs, i.e. graphs with edges and vertices.  Primitives exist for computing
properties such as edge connectivity, biconnected components, and edge or
vertex set induced subgraphs.  The graphs may have loops or multiple edges,
both directed and undirected, and arbitrary weights can be associated with
both edges and vertices.  Graphs can be drawn as a picture (a plot) for
display.  For example, here we create the Petersen graph and compute and factor
its characteristic polynomial.

  > with(networks):
  > factor(charpoly(petersen(),x));

                                          4        5
                           (x - 3) (x + 2)  (x - 1)

The spanpoly(G,p) function computes a polynomial for the undirected graph G
where p is a probability of failure associated with each edge.  When G is
connected, this is the all-terminal reliability polynomial of G.  Here is the
all-terminal reliability polynomial for the complete graph on 4 vertices.

  > spanpoly(complete(4),p);

                          3                    2      3
                       - p  (- 16 + 33 p - 24 p  + 6 p )


Share Library
=============

1: Contributions from Maple users
---------------------------------
The share library is a repository of applications codes, contributed primarily
by Maple users.  It is distributed with each version of Maple in both src and
Maple ".m" format.  The share library is being reorganized.  Beginning with
this version, it also includes
- TeX/LaTeX introductory documents on using Maple
- TeX/LaTeX support documentation for applications codes
- updates to library routines, i.e. bug fixes, efficiency improvements etc.
- examples of applications of Maple to problem solving
We have also endeavoured to ensure that each contribution comes with on-line
Maple style help files, and Maple style test files to help us ensure that the
code is working correctly.

2: How to access code from the share library from inside Maple
--------------------------------------------------------------
Users can access routines in the share library by reading them in directly
from the files using the read command.  Also, where appropriate, one can now
access them directly from inside Maple using the with command.

The command with(share); looks to see if the share library exists, i.e. it
is adjacent to the Maple library (it simply tries to read a file from it).
If successful, it assigns the global variable sharename to the path where
it found the share library, and then it executes the statement

  > libname := libname, sharename;

Now Maple's readlib command and with command will automatically search the
share library after first searching the Maple library.  If unsuccessful, the
user can locate the share library and set the libname variable directly.
For example, the fit routine in the share library can be used to fit a
formula to some data in the least squares sense.

  > with(share): # locate the share library
  > readlib(fit): # now finds the fit routine from the share library
  > fit([-1.5,0.5,1.5],[0,-2,-1.5], a*t^2+b*t+c, t);
   
                               2
                  .4999999997 t  - .5000000001 t - 1.874999999


Documentation for the code is in the file, i.e. after reading the file, ?fit
will print out a regular Maple style help file.  Note, in many cases,
additional documentation is included in TeX/LaTeX files.
See ?share,contents for a summary of the contents of the share library.

3: Electronic distribution version of the Maple share library
-------------------------------------------------------------
The share library will also be distributed electronically, firstly, over the
internet by using anonymous ftp, and secondly, by electronic mail, with an
electronic mail server.  The electronic version is be updated periodically,
about once every 3 months, with new contributions, corrections to previous
contributions etc.  Unlike the Maple version, it contains a directory of
updates to the Maple library, primarily simple bug fixes.
For directions on how to get code using anonymous ftp, electronic mail,
and how to install it and use it, see ?share for details.

4: Policy of the contributions to the share library
---------------------------------------------------
The code in the share library has been contributed freely by the authors to be
made freely available to all Maple users.  It is not to be sold for profit or
changed without the author's permission.  Authors who contribute code to the
share library will be asked to write Maple style on-line help documentation and
a test file.  Authors will also be asked to sign a non-exclusive agreement to
let us distribute your code, and to let us change your code to maintain it.


Miscellaneous
=============

- the catenation operator . now expands in ``.(a,b,c).(1..3) to yield
	a1, a2, a3, b1, b2, b3, c1, c2, c3

- expand of @ and @@ now handled e.g. expand((sin@@)(2)(x) ); ==> sin(sin(x))
- evalf of @ and @@ now handled e.g. evalf((sin@@2)(2)); ==> .7890723436

- anames(t) returns all names of type t

- a[1] := x; is dissallowed if a is assigned an object other than
	an array or table

- f()[1] is now allowed; it returns unevaluated

- Changes to fortran and C
  - use appendto instead of writeto to append output to a file instead of
    overwriting it
  - both now translate subscripts e.g. a[i-2*j] where the 2 here
    is understood to be an integer
  - both now convert symbolic constants e.g. Pi to floating point
  - optional parameter  digits = n  for specifying the precision to be used
	in converting constants to floating point
  - C now also breaks up large expressions which otherwise cause
     some compilers to break

- Changes to dsolve/numeric
  The output of dsolve({...},{...},numeric) is a procedure f where f(x)
  returns a tuple of values.  E.g dsolve({...},{y(x),z(x)},numeric);
  returns f a procedure where f(1) returns  x=1, y(x)=y(1), z(x)=z(1)
  The odeplot routine in the plots package can be used to plot the result.

- mellin speeded up by a factor of 4-30

- ifactor has been sped up for the case of a perfect power

- series(f(x),x=a); now allows +-infinity for a
  > series(ln(1-x),x=-infinity);

                                  1      1      1      1        1
            - ln(- 1/x) - 1/x - ---- - ---- - ---- - ---- + O(----)
                                   2      3      4      5       6
                                2 x    3 x    4 x    5 x       x

- signum(f) where f is a symbolic constant will use interval arithmetic at
  Digits precision to determine the sign of f, e.g. signum(Pi-4*sin(1));

- the for loop clauses by, to, from and while can now
  appear in any order

- Changes to automatic simplifications
  - the ln(1/x) ==> -ln(x) automatic simplification has been turned off.
    ln(a^n) ==> n ln(a) is now done iff signum(a) = 1, i.e. x is provably +ve
  - the ln(exp(x)) ==> x automatic simplification has been turned off.
    ln(exp(x)) ==> x is now down iff Im(x) returns 0, i.e. x is provable real
  - the automatic simplification sqrt(x^2) ==> x (incorrect for -ve x) is being
    fixed for the next version (the change is more difficult than the others)
  - the arcsin(sin(x)) ==> x arctrig simplifications have been turned off
  - inverse functions simplifications have been added e.g. sin@@(-1) ==> arcsin
  - trig simplifications for multiples of Pi/8, Pi/10, Pi/12 have been added
  > sin(Pi/8), sin(Pi/10), sin(Pi/12);

                        1/2 1/2       1/2                  1/2 1/2
              1/2 (2 - 2   )   , 1/4 5    - 1/4, 1/2 (2 - 3   )

- given a file of text, the makehelp function makes a Maple TEXT object out
  of it, i.e. an on-line help page.  I.e. you can make your own help pages
  which can be displayed using the ? command using this.

- Additional simplifications for Dirac and Heaviside, and the arc
  trigonomentric functions are provided through the simplify facility, e.g.
  > simplify( Heaviside(x-1)*Heaviside(x-3) );

                                Heaviside(x - 3)

  > simplify( F(x+3)*Dirac(x) );

                                 F(3) Dirac(x)

  > simplify( arctan(x)+arctan(1/x) );

                                1/2 signum(x) Pi

Newsgroups: sci.math.symbolic