1#!/usr/bin/env python
2# -*- coding: utf-8
3#
4# This test shows how you can solve a polynomial using different
5# algorithms.
6#
7# Author: Leonardo Robol <leonardo.robol@sns.it>
8# Date: 13/02/2014
9
10from mpsolve import *
11
12if __name__ == "__main__":
13
14    ctx = Context()
15    poly = MonomialPoly(ctx, 4)
16
17    poly.set_coefficient (0, -1)
18    poly.set_coefficient (4,  1)
19
20    roots = ctx.solve (poly, Algorithm.SECULAR_GA)
21    roots2 = ctx.solve (poly, Algorithm.STANDARD_MPSOLVE)
22
23    print("Polynomial solved by secsolve: %s" % map (complex, roots))
24    print("Polynomial solved by unisolve: %s" % map (complex, roots2))
25