Polynomials files

The Polynomial files, usually saved with the extension .pol, can be used to describe a polynomial input for MPSolve (or a secular equation). Secular equations are equations of the form $$ \sum_{i = 1}^n \frac{a_i}{x - b_i} - 1 = 0 $$

They are composed of two different parts: 1. The preface, containing the information on the characteristics and structure of the polynomial 2. The coefficient list, that explicitly lists the coefficients of the polynomial (or of the secular equation).

These parts are separated by an empty line.

The preface

The preface is composed by single line statements that end with the symbol ;. They can be simple statements or assignments. Some examples are:

Monomial; 
Degree=5;
Integer;

In this case the preface is saying that we are inserting a polynomial, represented in the monomial basis, of degree 5 that has integer coefficients.

All the possible options are listed below:

  1. Complex: This option is used to specify that the polynomial has complex coefficients, that will be listed giving the real and complex part, separately.
  2. Real: The polynomial has real coefficients, so that no imaginary part of the coefficients will be specified.
  3. Degree: This option needs a value, and is used to set the degree of the polynomial. An example is Degree=5.
  4. Integer: The coefficients are integer numbers.
  5. Rational: The coefficients are rational and will be specified in the form a/b or simply a.
  6. FloatingPoint: The polynomials are floating point numbers, and so will be listed in the standard notation 1.234e5. Integer input is also accepted.
  7. Monomial: The input is given in the monomial basis, and so n + 1 coefficients will be inserted (2n + 2 if the polynomial is complex) where n is the degree of the polynomial. The coefficients must be listed in increasing degree order.
  8. Secular: The input is given as a secular equation. The coefficients a,,i,, and b,,i,, need to be specified and need to be listed in pairs a,,i,, b,,i,,.
  9. Precision: Set the bits of precision of the input coefficients.
  10. Dense: The input polynomial has a dense coefficient list.
  11. Sparse: The input polynomial has a sparse coefficient list; in this case each coefficient must be inserted with its degree as a pair degree, coefficient.

The coefficient list

The second part of the input file is composed by a list of the coefficients of the selected polynomial or secular equation. The coefficients that shall be listed depends on the options that have been previously selected in the preface.

More precisely:

  1. If the option Dense has been set, the coefficient list should report the coefficients in blocks starting from the lowest degree to the higher (where this makes sense, i.e., for polynomials; for secular equations the coefficient order does not matter).
  2. If the option Sparse has been set, the coefficients should be listed in pairs (degree, coefficient block), and only zero coefficients can be omitted.

The coefficient block

A single coefficient block is generally composed by the real part and imaginary part of the coefficient, unless the options Real has been specified. In this case the imaginary part must be omitted. For secular equations a coefficient block contains the a,,i,, coefficient followed by the b,,i,, coefficient (each one with its imaginary part unless the Real options has been specified).

Some examples follow to further clarify the syntax.

Some examples

Here is the code for the polynomial x^3^ - 1, in its Dense and Sparse version, respectively.

! Dense version of the polynomial x^3 - 1
Dense;
Monomial;
Degree=3;
Real;
Integer;

-1 0 0 1
! Sparse version of the polynomial x^3 - 1. This is handier to write but also
! more efficient since sparsity is exploited in the algorithm. 
Sparse;
Monomial;
Real;
Integer;

3 1
0 -1

Here is an example of a polynomial that has complex coefficients.

! Input file for the polynomial x^2 - 2ix + 1. 
Monomial;
Integer;
Complex;
Degree = 2;

1 0
0 −2
1 0

Here is another example of a polynomial that has complex rational coefficients.

! Input file for the polynomial x^2 - (2/3)ix + 1/7 + (4/3)i. 
Monomial;
Rational;
Complex;
Degree = 2;

1/7 4/3
0 −2/3
1 0

And finally an example of a secular equation:

! Input file for the secular equation 1/(x + 2) - 4/(x + 5) - 1 = 0
Secular;
Integer;
Real;
Degree = 2;

1 −2
−4 −5