MPSolve input format


Polynomial format

The MPSolve input file should contain:

For instance, "dri" stands for a dense real polynomial with integer coefficients.

 

Examples:

The polynomial x4 + 2 x + 5 can be coded as follows (extra spaces are ignored):

in dense form or in sparse form

! p(x)=x^4+2x+5
dri
0
4
5
2
0
0
1

 


! p(x)=x^4+2x+5
sri
0
4
3
0
5
1
2
4
1

Clearly, polynomials like x500 + 1 are more easily written in their sparse form as follows:

! p(x)=x^500+1
sri
0
500
2
0
1
500
1


Coefficient formats

Integer coefficients of any length can be used such as real coefficients in scientific format.

Complex values are coded as the real part followed the imaginary part.

Rational numbers are written as the numerator followed by the denominator.

Complex numbers with rational real and imaginary parts are coded as a quadruples as follows:

 

Examples:

Below we report some examples of input formats where the coefficients are:

! Example 1, complex/integer
! p(x)=x^200+(1+3i)x^70 +1
sci
0
200
3

0
1
0
70
1
3
200
1
0

! Example 2, real/rational
! p(x)=(3/4)x^200 + (1/3)x^70 + 1
srq
0
200
3

0
1
1
70
1
3
200
3
4

! Example 3, complex/rational
! p(x)=x^2 + (3/2+i*5/7)x + 2
dcq
0
2

2
1
0
1

3
2
5
7

1
1
0
1

! Example 4, real/float
! p(x)=1.234e200 x^3 + 1.5e-200 x^2 + 1.3e-200
! the precision of the coefficients is 15 digits
drf
15
3

1.3e-200
0.0e0
1.5e-200
1.234e200

any other mix is allowed and the input form follows the above lines.

Many coding examples can be found among the test suite.


home