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
1
vote
1 answer

How to know if a number is in a collection of numbers in pari?

I use pari most of the time for my computational number theory research. I entered the following: for(x=1,100,print1(eulerphi(n)-1)) which gives the values of φ(n)-1 for integers 1 to 100. Here φ(n) is the number of integers less than n which are…
user14697742
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

How to use Tuple/Array/Vector to call PARI/GP from Python (ctypes)?

I would like to call PARI/GP from Python. I need to use ellisdivisible(E; P; n;{&Q}) function of PARI (see function no 3.15.35 on page 441 in this link:), so I have to pass 2 vectors or arrays (e.g, E = ellinit([0,-1,1,0,0], K);P = [0,0];), how I…
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

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
1 answer

Conductor of an elliptic curve in GP/Pari

I'm looking for a function that takes in as its input an elliptic curve and gives as an output the conductor of the curve. This should be a really simple built-in function to Pari, but frustratingly the code E = ellinit("11a1"); E.conductor Gives…
JonHales
  • 125
  • 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
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

Troubleshooting Math::PARI crash inside mod_perl

I build (brewed) my own perl, then the mod_perl module, and then installed all required perl libraries. The mod_perl environment works fine. One-liners with Math::PARI also work, for example: perl -MMath::Pari -e "use Math::Pari ':float',…
Andrew Dwojc
  • 119
  • 10
1
vote
1 answer

Garbage management in Pari C

Can I see how much of my stack has been filled up? I suppose that if I could see the value of avma, that'd help. Moreover, if I do an operation on a variable and store the return value in the same variable, does it replace the initial value of the…
AdveRSAry
  • 187
  • 7
1
vote
1 answer

Custom precision bits in Pari C for t_REAL

I need custom precision bits for t_REAL in Pari C library. I've tried changing the BITS_IN_LONG variable and made sure that I change that the precision exponent of my GEN variable, still I'm only getting a real number upto 39 decimal places. Is…
AdveRSAry
  • 187
  • 7