| 1 |
MPSOLVE 3.2.2 |
| 2 |
============= |
| 3 |
|
| 4 |
MPSolve is a C package to solve polynomials and secular equations. It released under the terms |
| 5 |
of the GNU General public license as it specified in the COPYING file inside the source directory. |
| 6 |
|
| 7 |
### How to install MPSolve |
| 8 |
|
| 9 |
If you have downloaded an official MPSolve tarball you can |
| 10 |
install MPSolve simply by typing these commands in a shell: |
| 11 |
|
| 12 |
./configure |
| 13 |
make |
| 14 |
[sudo] make install |
| 15 |
|
| 16 |
whilst, if you have checked out the git repository directly |
| 17 |
you have to use the script `autogen.sh` first, and then the |
| 18 |
usual `configure`, `make`, `make install` sequence. |
| 19 |
|
| 20 |
The last command is optional and install mpsolve system-wide. You can simply |
| 21 |
use the mpsolve executable built in its directory by launching |
| 22 |
`./src/mpsolve/mpsolve` from the source directory. |
| 23 |
|
| 24 |
Full install is needed to use MPSolve as a library in other C, |
| 25 |
FORTRAN, Matlab, ... software without further tweaking. |
| 26 |
|
| 27 |
The `examples/` folder contains a mix of example source files that use |
| 28 |
MPSolve and bindings for other programming languages such as Python, |
| 29 |
Octave, Matlab (TM), ... |
| 30 |
|
| 31 |
### Using the mpsolve binary |
| 32 |
|
| 33 |
The mpsolve binary is thought as a simple way to solve polynomials |
| 34 |
and/or secular equation using a text file as input. A generic |
| 35 |
input file for mpsolve is composed by a preamble and |
| 36 |
a body. The comments are identified by lines starting with '!'. |
| 37 |
|
| 38 |
In the preamble will be specified all the options for solving |
| 39 |
and some general information about the polynomial. |
| 40 |
The body will contain the coefficients. |
| 41 |
|
| 42 |
Every option in the preamble has to be specified as Key; or Key=value; |
| 43 |
This is an example of a valid input for mpsolve that specifies |
| 44 |
the polynomial x^5 - 1 |
| 45 |
|
| 46 |
! File: nroots5.pol |
| 47 |
Degree=5; |
| 48 |
Monomial; |
| 49 |
Real; |
| 50 |
Integer; |
| 51 |
|
| 52 |
-1 |
| 53 |
0 |
| 54 |
0 |
| 55 |
0 |
| 56 |
0 |
| 57 |
1 |
| 58 |
|
| 59 |
! EOF |
| 60 |
|
| 61 |
The same polynomial can be specified by using sparse notation: |
| 62 |
|
| 63 |
! File nroots5sparse.pol |
| 64 |
Degree=5; |
| 65 |
Monomial; |
| 66 |
Real; |
| 67 |
Integer; |
| 68 |
Sparse; |
| 69 |
|
| 70 |
5 1 ! Highest degree coefficient |
| 71 |
0 -1 ! Coefficient of degree 0 |
| 72 |
|
| 73 |
! EOF |
| 74 |
|
| 75 |
If the `Real` option is not specified real and imaginary part of the coefficients |
| 76 |
will be needed as input. Rational input is also used in here: |
| 77 |
|
| 78 |
! File: random-poly.pol |
| 79 |
Degree=3; |
| 80 |
Monomial; |
| 81 |
Rational; |
| 82 |
|
| 83 |
45/9 7/4 |
| 84 |
3/23 293/34234 |
| 85 |
234/2369234 2348234/324 |
| 86 |
324 234324/23 |
| 87 |
|