Questions tagged [pari-gp]

Questions about the computer algebra system PARI/GP, including questions about the GP scripting language and the gp interactive shell. Please use the tag [pari] for the PARI C library.

The description in the tag exerpt is a direct quotation from the PARI/GP Development Headquarters, taken on Apr. 5, 2013. This tag is intended for questions about the computer algebra system PARI/GP, including questions about the GP scripting language and the gp interactive shell. See the separate tag for the PARI C library.

114 questions
1
vote
1 answer

Returning Powers of a Two-Variable Polynomial as a Vector in PARI/GP?

I'm trying to view the monomials of a two-variable polynomial in vector form. So, for example, if I input x^2 + x^3*y + x*y + y^2 + 1, I would like to view it as [[2;0], [3;1], [1;1], [0;2], [0;0]] - a vector made of column vectors. If I use Vec on…
Mystery_Jay
  • 161
  • 5
1
vote
1 answer

A vector of polynomials each defined as a function

I'm trying to get a vector of polynomials, but within the vector have each polynomial defined by a function in Pari. For example, I want to be able to output a vector of this form: [f(x) = x-1 , f(x) = x^2 - 1, f(x) = x^3 - 1, f(x) = x^4 - 1, f(x)…
Mystery_Jay
  • 161
  • 5
1
vote
1 answer

How to sort a list of mixed integers / fractions in pari/gp

Currently I'm implementing an algorithm to return the Farey Series of order n by calling my function with FareySeries(n). This works quite well,for example calling L = FareySeries(4) returns List([0, 1, 1/2, 1/3, 1/4, 2/3, 3/4]) but I need the list…
1
vote
1 answer

Pari GP function 'read' produces *** expression nested too deeply

I had Pari calculate some polynomials and write them in a file. Now I want to read them back in and I encounter *** expression nested too deeply. There are no loops in the file it is simply {P[n]=(some (Laurent) polynomial in q);} on the n-th…
Campbell
  • 11
  • 1
1
vote
2 answers

Binary splitting in Pari/GP

While trying to implement a sine-function without a FPU I recognized that all of the input is already rational, so I decided to try an all-rational approach. Probably slower but: why not? The series is linearly convergent and hence has a chance for…
deamentiaemundi
  • 5,502
  • 2
  • 12
  • 20
1
vote
0 answers

Zeroes of a Function in a Range in PARI/GP

I'm trying to find the zeroes of functions within the range [0,1]. My functions are generally looking something like this: F(t)=2*sin(8*Pi*t)+2*sin(2*Pi*t)-1 The naive method I've tried so far is getting a very crude plot of the function into Pari,…
Mystery_Jay
  • 161
  • 5
1
vote
2 answers

How to reverse the digits of an integer in PARI/GP?

As part of a mini-project I'm doing, I need a way to reverse the digits of an integer in PARI/GP (the project is mainly on palindromic numbers and digit sums). What I'm trying to achieve in code form is fun(13453) giving 35431. For example, I've…
user8818397
1
vote
2 answers

Iterating over distinct permutations of a vector in Pari/GP

I want to iterate over all distinct permutations of a vector. I have tried doing this by using vecextract() in combination with numtoperm() to create a vector of permutations, and vecsort(,,,8) to remove equivalent permutations. Unfortunately,…
Joe Slater
  • 115
  • 3
1
vote
1 answer

How can I reverse a vector in PARI/gp

I need to reverse a vector in PARI/gp. I couldn't find a built-in function so I tried this: vector(10^4,i,vector(10^4,i,i)[10^4-i+1]) That's very slow - it took nearly four seconds. So then I tried this: Vec(polrecip(Pol(vector(10^6,i,i)))) This…
Joe
  • 59
  • 6
1
vote
1 answer

How to implement time in Pari/GP

I have Pari/GP 32-bit and would like to implement any type of code which runs for a limited amount of time, then automatically stops if nothing is produced by that time. Here is a pseudocode example: command ... run command if run time over 3…
J. Linne
  • 275
  • 4
  • 15
1
vote
3 answers

How do I represent sparse arrays in Pari/GP?

I have a function that returns integer values to integer input. The output values are relatively sparse; the function only returns around 2^14 unique outputs for input values 1....2^16. I want to create a dataset that lets me quickly find the inputs…
Joe
  • 59
  • 6
1
vote
1 answer

How can I define the "primality order" in pari/gp?

I'm deeply interested in number theory and want to test some of my ideas in pari/gp, but am not familiar with this software. Specifically, I want to define a 'primeorder' function that maps an integer n to what I call its primality order, which is 0…
1
vote
2 answers

How to increase enough stack size in Pari/Gp for command to work

I am working with GP and minimum polynomials as follows running on ASUS x75: (19:25) gp > elt=Mod(a*x^3+b*x^2+c*x+d,('x^5-1)/('x-1)) %122 = Mod(a*x^3 + b*x^2 + c*x + d, x^4 + x^3 + x^2 + x + 1) (19:25) gp > (poly=minpoly(elt,x='x)) %123 = x^4 + (a +…
J. Linne
  • 275
  • 4
  • 15
1
vote
1 answer

Rcpp does not compile cpp source with pari.h headers

I wrote a cpp source with pari.h header file included: #include #include #include #include #include #include #include // for…
Serhat Cevikel
  • 720
  • 3
  • 11
1
vote
1 answer

In pari-gp, any stuff to map the finite field to its some extension?

Say, I have a polynomial p(x) over GF(2) and a polynomial g(x) over GF(4). For example, gf2 = gf(2, 1); gf4 = gf(2, 2); p2 = Polrev(vector(5, i, random(gf2))); p4 = Polrev(vector(7, i, random(gf4))); p2 * p4 >> *** at top-level: p2*p4 >> *** …
aka_test
  • 27
  • 5