1Metadata-Version: 1.0 2Name: cypari2 3Version: 2.1.2 4Summary: A Python interface to the number theory library PARI/GP 5Home-page: https://github.com/sagemath/cypari2 6Author: Luca De Feo, Vincent Delecroix, Jeroen Demeyer, Vincent Klein 7Author-email: sage-devel@googlegroups.com 8License: GNU General Public License, version 2 or later 9Description: CyPari 2 10 ======== 11 12 .. image:: https://travis-ci.org/sagemath/cypari2.svg?branch=master 13 :target: https://travis-ci.org/sagemath/cypari2 14 .. image:: https://readthedocs.org/projects/cypari2/badge/?version=latest 15 :target: https://cypari2.readthedocs.io/en/latest/?badge=latest 16 :alt: Documentation Status 17 18 A Python interface to the number theory library `PARI/GP <http://pari.math.u-bordeaux.fr/>`_. 19 20 This library supports both Python 2 and Python 3. 21 22 Installation 23 ------------ 24 25 GNU/Linux 26 ^^^^^^^^^ 27 28 A package `python-cypari2` or `python2-cypari2` or `python3-cypari2` might be 29 available in your package manager. 30 31 Using pip 32 ^^^^^^^^^ 33 34 Requirements: 35 36 - PARI/GP >= 2.9.4 (header files and library) 37 - Python 2.7 or Python >= 3.4 38 - pip 39 - `cysignals <https://pypi.python.org/pypi/cysignals/>`_ >= 1.7 40 - Cython >= 0.28 41 42 Install cypari2 via the Python Package Index (PyPI) via 43 44 :: 45 46 $ pip install cypari2 [--user] 47 48 (the optional option *--user* allows to install cypari2 for a single user 49 and avoids using pip with administrator rights). Depending on your operating 50 system the pip command might also be called pip2 or pip3. 51 52 If you want to try the development version use 53 54 :: 55 56 $ pip install git+https://github.com/sagemath/cypari2.git [--user] 57 58 If you have an error saying libpari-gmp*.so* is missing and have all requirements 59 already installed, try to reinstall cysignals and cypari2 60 61 :: 62 63 $ pip install cysignals --upgrade [--user] 64 $ pip install cypari2 --upgrade [--user] 65 66 Other 67 ^^^^^ 68 69 Any other way to install cypari2 is not supported. In particular, ``python 70 setup.py install`` will produce an error. 71 72 Usage 73 ----- 74 75 The interface as been kept as close as possible from PARI/GP. The following 76 computation in GP 77 78 :: 79 80 ? zeta(2) 81 %1 = 1.6449340668482264364724151666460251892 82 83 ? p = x^3 + x^2 + x - 1; 84 ? modulus = t^3 + t^2 + t - 1; 85 ? fq = factorff(p, 3, modulus); 86 ? centerlift(lift(fq)) 87 %5 = 88 [ x - t 1] 89 90 [x + (t^2 + t - 1) 1] 91 92 [ x + (-t^2 - 1) 1] 93 94 translates into 95 96 :: 97 98 >>> import cypari2 99 >>> pari = cypari2.Pari() 100 101 >>> pari(2).zeta() 102 1.64493406684823 103 104 >>> p = pari("x^3 + x^2 + x - 1") 105 >>> modulus = pari("t^3 + t^2 + t - 1") 106 >>> fq = p.factorff(3, modulus) 107 >>> fq.lift().centerlift() 108 [x - t, 1; x + (t^2 + t - 1), 1; x + (-t^2 - 1), 1] 109 110 The object **pari** above is the object for the interface and acts as a 111 constructor. It can be called with basic Python objects like integer 112 or floating point. When called with a string as in the last example 113 the corresponding string is interpreted as if it was executed in a GP shell. 114 115 Beyond the interface object **pari** of type **Pari**, any object you get a 116 handle on is of type **Gen** (that is a wrapper around the **GEN** type from 117 libpari). All PARI/GP functions are then available in their original names as 118 *methods* like **zeta**, **factorff**, **lift** or **centerlift** above. 119 120 Alternatively, the pari functions are accessible as methods of **pari**. The 121 same computations be done via 122 123 :: 124 125 >>> import cypari2 126 >>> pari = cypari2.Pari() 127 128 >>> pari.zeta(2) 129 1.64493406684823 130 131 >>> p = pari("x^3 + x^2 + x - 1") 132 >>> modulus = pari("t^3 + t^2 + t - 1") 133 >>> fq = pari.factorff(p, 3, modulus) 134 >>> pari.centerlift(pari.lift(fq)) 135 [x - t, 1; x + (t^2 + t - 1), 1; x + (-t^2 - 1), 1] 136 137 The complete documentation of cypari2 is available at http://cypari2.readthedocs.io and 138 the PARI/GP documentation at http://pari.math.u-bordeaux.fr/doc.html 139 140 Contributing 141 ------------ 142 143 Submit pull request or get in touch with the SageMath developers. 144 145Keywords: PARI/GP number theory 146Platform: UNKNOWN 147