Questions tagged [pari]

a C library targeted at number theorists and mathematicians allowing fast number-theoretic computations (factorizations, algebraic number theory, elliptic curves...), also including routines for computing with matrices, polynomials, power series, algebraic numbers etc.

This tag is for the C-library PARI. See for the scripting language GP and associated computer algebra system PARI/GP. Questions with this tag should generally also have the tag.

118 questions
2
votes
1 answer

GEN variables not identified - PARI library C

I have recently installed PARI library on ubuntu 16.04. The set of examples provided with the source are running correctly but , if I use "gun", "ghalf", etc., gcc compilation fails with error : error: ‘gun’ undeclared (first use in this function) I…
Mayank
  • 214
  • 1
  • 7
2
votes
1 answer

How to run C program using pari library with gcc?

#include #include int main(void) { GEN i,j,k; pari_init(500000,2); i=gun; j=stoi(3); k=gadd(i,j); printf("1+3=%s",GENtostr(k)); return 0; } $ I'm a beginner to work on pari library in C. I've installed pari library in…
2
votes
2 answers

power function in pari library

I am trying to use the PARI library for C. I am new to it. Whenever I try to use any function I get a segmentation fault or stack overflow error. Can anyone please provide me a link with detailed functionality of all constructs and functions in…
siri
  • 713
  • 3
  • 11
  • 24
2
votes
1 answer

Implementing bitwise operations using pari c library

I am new to using the PARI C library. How can I perform bitwise ('and' or 'or') operations on the GEN type variables?
siri
  • 713
  • 3
  • 11
  • 24
2
votes
1 answer

Copying numbers from PARI/GP

I have a problem, for which there probably is an easy solution. Suppose, I have calculated a large number in PARI/GP, lets say, 10,000 digits long. I want to copy this number in a normal text file, such that it can be copied back to PARI/GP. The…
Peter
  • 214
  • 1
  • 10
2
votes
3 answers

Finding entry of vector in PARI/GP?

With PARI/GP, if I have a vector with unique entries: a = [9, 7, 3, 5, 2, 8, 1, 0, 11] how do I get the position (index) of an entry in the vector a? like: i = vectorsearch(a, 8); a[i] %1 = 8 Converting into a set and using setsearch doesn't…
Ystar
  • 351
  • 1
  • 3
  • 8
2
votes
1 answer

Python c_types .dll functions (pari library)

Alright, so a couple days ago I decided to try and write a primitive wrapper for the PARI library. Ever since then I've been playing with ctypes library in loading the dll and accessing the functions contained using code similar to the…
user300330
2
votes
2 answers

calculating the pseudoinverse with PARI/GP

How can I calculate the pseudoinverse for an arbitary mxn- matrix in PARI/GP ? Is there a simple way, or do I have to program the process completely ?
Peter
  • 214
  • 1
  • 10
1
vote
1 answer

how to get the count of a number in a List PARI/GP

is there a method to get the count of a given number in a List? I have a List for which I want to verify, that no number is more than x-times in it.
Lottn Leon
  • 13
  • 2
1
vote
1 answer

Creating graphs using code from Pari-GP, but using Sage's graphing tools

everyone! I know this is probably a dumb question, but I'm having a lot of trouble with Sage, and it's frustrating the hell out of me. To give a bit of an explanation, I code entirely in pari-gp. I don't have a single problem with my code in…
Richard Diagram
  • 209
  • 1
  • 7
1
vote
2 answers

locally setting series precision -- pari-gp

everyone. This is another quick question about pari-gp. I've written my main file such that two different functions work better if \ps 100 or \ps 36; and so I want to specify to some functions, before running, so that locally we can say \ps 100 or…
Richard Diagram
  • 209
  • 1
  • 7
1
vote
1 answer

Getting the constant portion of an expression in Pari-gp

This is probably a pretty stupid question--but I can't seem to find a relevant explanation in the pari-gp literature. I'm looking for a function in the library that takes a polynomial, or a series, or a constant, and spits out the constant portion…
Richard Diagram
  • 209
  • 1
  • 7
1
vote
2 answers

Creating an initialization file in pari-gp

This question is definitely a stupid question. But, coming from C; I'm having trouble adding header files or "an initialization" file to my pari-gp code. This is to mean; I have a 1hr compile of code to make one vector; and I can use that vector…
Richard Diagram
  • 209
  • 1
  • 7
1
vote
1 answer

Passing values outside user's defined function in PARI GP

I want to write a function SWAP to swap 2 integers a and b in PARI. This function does not return any values but I want the variables outside the function to store the new values. I don't know how to fix this. This is my function: swap(a,b) = { t=a;…
1
vote
1 answer

Looping over specific values in PARI/GP

I have a large collection of vectors, each of the form [a,b,c,d]. For each vector, I want to return the result [a,b,c,d,a+b^2+c^3+d^4]. What would be the best way of doing this? For example, say my vectors are V = [ [1,2,3,4], [5,6,7,8], [9, 10, 11,…
Mystery_Jay
  • 161
  • 5