Jump to content

MPSolve

0% developed
From Wikibooks, open books for an open world

This page describes the usage of MPSolve.

Usage

[edit | edit source]

The executable program of the package is called unisolve (univariate polynomial solver).

It can be run from command line in console.

There are 3 main ways of running MPSolve:

1. reading from the standard input stream (typically the keyboard).

./unisolve

(one can type here for example content of the file mand31.pol, without comments line, which start with "!" character )


2. reading from input file (holding the input polynomial in the form: degree and list of coefficients)

./unisolve Data/mand31.pol


3. using "user defined" polynomials. In this case one uses 2 files:

- mps_user.c (containing definition of polynomial in the form of recurrence relation)

- input file containing only degree of polynomial


./unisolve Data/umand31.pol


compare the files mand31.pol and umand31.pol to see the differences. The output files should be the same.

If one wants to use other type of "user defined" polynomial than this one which is contained in the standard mps_user.c file, then should:

- edit usr_mand.c and modify the code in order to obtain the implementation of the polynomial that you want

- copy usr_mand.c into mps_user.c ( it should be readable and writable by the user)

- run make ( to recompile the package)

- write the desired degree of polynomial in the input file (here for example: umand31.pol )

- run MPSolve ( the way number 3)

./unisolve Data/umand31.pol

Output

[edit | edit source]

In all above examples output will be on the screen.

If one wants to save the output to the text file with res extension in directory Results:

./unisolve Data/umand31.pol >Results/umand31.res

Plotting the data from output file in gnuplot

[edit | edit source]
Example of plotting MPSolve data in Gnuplot


First create file for gnuplot ( use -Og option ), for example:

./unisolve -Og Data/umand31.pol >Results/umand31g.res

Run gnuplot:

gnuplot

and inside gnuplot:

plot "/home/adam/mpsolve/MPSolve-2.2/Results/umand31g.res" 

To save plot in postscript file:

set term postscript 
set output "umand31.eps"
plot "/home/adam/mpsolve/MPSolve-2.2/Results/umand31g.res"  


To go back to the normal output (screen - X Window plotting terminal), then :

  set output
  set term x11