PARILink connects Wolfram Language to PARI/GP for number theory.
Documentation · Cloud resource · Releases
- Wolfram Language 15.0 or later
- PARI/GP 2.17 or later
Uses an existing GP installation. Tested on Linux x86-64 and macOS Apple silicon with GP 2.17.4 and 2.19.0. See the compatibility report.
Install the latest release from Wolfram Cloud:
PacletInstall[
ResourceObject[
"https://www.wolframcloud.com/obj/wolframinstitute/" <>
"DeployedResources/Paclet/WolframInstitute/PARILink"
]["PacletFile"],
ForceVersionInstall -> True,
"ShowProgress" -> True
];Versioned paclets and SHA-256 checksums are also on GitHub Releases.
Load the package:
Needs["WolframInstitute`PARILink`"];Start GP:
session = StartPARISession[];Find the Galois group of a quintic:
polynomial = PARIEvaluate[session, "x^5 - x - 1"];Last[PARICall[session, "polgalois", polynomial]]Returns "S5", the symmetric group on five letters.
Count points on an elliptic curve over the field with 101 elements:
curve = PARICall[session, "ellinit", {0, 0, 0, -1, 0}, 101,
"ReturnType" -> "Object"];PARICall[session, "ellcard", curve]Returns 104, including the point at infinity.
Compute Fourier coefficients of a weight 2, level 11 newform:
form = PARIEvaluate[session, "mfeigenbasis(mfinit([11,2],0))[1]",
"ReturnType" -> "Object"];PARICall[session, "mfcoefs", form, 10]Returns {0, 1, -2, -1, 2, 1, 2, -2, 0, -2, -2} (degrees 0 through 10).
Close GP and release its objects:
DeleteObject[session];| GP result | Wolfram Language result |
|---|---|
| Integers, rationals, exact complex numbers, strings | Copied values |
| Vectors and matrices | Lists |
| Other values | PARIObject |
Use "ReturnType" -> "Object" to reuse a GP structure in later calls.
Normal[object] copies a supported retained value. Mutable lists and maps
remain objects; copy their contents with Vec or Mat.
- GP evaluation errors return
Failureand leave the session usable. - Timeouts, interruptions, and lost connections stop the session.
See PARICall for time limits and output options.
To use a source checkout, load its paclet directory before Needs:
PacletDirectoryLoad["/path/to/PARILink/PARILink"];make allmake test-pariBuild and publishing instructions: CONTRIBUTING.md. Security reports: SECURITY.md.
PARILink code uses the MIT License. PARI/GP is separately licensed; see third-party notices.