next up previous contents
Next: C++ Routines for Maple Up: Polynomial Utilities Previous: Sign Determination

Polynomial Input and Output

  The text format for a polynomial in a (text) input or output file should be one of :

or

displaymath3775

where is the string representing the first or leading variable of the polynomial; tex2html_wrap_inline3784 are the degrees of the coefficients in ordered such that . The coefficients corresponding to each degree (which is a polynomial itself) are placed to the right of that degree; (k) represents a polynomial which is terminal, i.e. has its entry a number, which can be either an integer or a floating point number. For example the polynomial tex2html_wrap_inline2866 the text representation would be :

displaymath3776

The following routines allow reading in polynomials in various forms, as well as printing them in various forms.

  1. Syntax
    Polynomial read_poly(ifstream& inFile, int input_type = SMALLINT, int poly_type = INTMODP, int slp_type = INTMODP)
    Description
    Reads a polynomial in sparse recursive format from the given input text file. The format of the polynomial should be the text format described above. The function has three optional arguments for controlling the input operation :
    1. input_type. Specifies the type of the numerical coefficients of the input polynomial in the text file - can be one of SMALLINT (default) and FLOAT.
    2. poly_type. Specifies the type of the numerical coefficients of the Polynomial type that is created after reading in the text polynomial - can be any of the Field_element sub-types. Default is INTMODP.
    3. slp_type. Specifies the type of the numerical coefficients of the Slp type that is formed (if any coefficients are to be read in as straight-line programs - read below for when this happens).

    read_poly works recursively by processing the text file and based on the three type arguments reads in the text polynomial (ignoring white space) and creates a Polynomial object of the appropriate type with the appropriate coefficients. If the leading variable of the current polynomial is an Slp variable (i.e. a variable declared to be a Slp variable by insertion in the Slp variable list), it will read the rest of the current (coefficient) polynomial as an Slp . Otherwise it will read it as a polynomial. Example : Let x1, x2 be Polynomial variables and s1 an Slp variable. Then

    displaymath3777

    will be read as a polynomial in x1 with its leading coefficient (of degree 2) an Slp , its next coefficient (degree 1) a polynomial in x2 and its last coefficient (degree 0) a polynomial in x2 which in turn has its leading coefficient an Slp .


next up previous contents
Next: C++ Routines for Maple Up: Polynomial Utilities Previous: Sign Determination

Ashu Rege
Fri May 9 17:57:21 PDT 1997