@@ -2611,24 +2611,6 @@ cdef class Gen(Gen_base):
2611
2611
"""
2612
2612
return self .new_ref(gel(self .fixGEN(), 2 ))
2613
2613
2614
- def precision (x , long n = - 1 ):
2615
- """
2616
- Change the precision of `x` to be `n`, where `n` is an integer.
2617
- If `n` is omitted, output the real precision of `x`.
2618
-
2619
- INPUT:
2620
-
2621
- - ``x`` - gen
2622
-
2623
- - ``n`` - (optional) int
2624
-
2625
- OUTPUT: gen
2626
- """
2627
- if n <= 0 :
2628
- return precision(x.g)
2629
- sig_on()
2630
- return new_gen(precision0(x.g, n))
2631
-
2632
2614
def round (x , bint estimate = False ):
2633
2615
"""
2634
2616
round(x,estimate=False): If x is a real number, returns x rounded
@@ -3686,6 +3668,19 @@ cdef class Gen(Gen_base):
3686
3668
[1, 1/10000000019*x]
3687
3669
>>> pari(f).nfbasis(fa=[2,p]) # Equivalent with the above
3688
3670
[1, 1/10000000019*x]
3671
+
3672
+ The following alternative syntax closer to PARI/GP can be used
3673
+
3674
+ >>> pari.nfbasis([f, 1])
3675
+ [1, x]
3676
+ >>> pari.nfbasis(f)
3677
+ [1, 1/10000000019*x]
3678
+ >>> pari.nfbasis([f, 10**6])
3679
+ [1, x]
3680
+ >>> pari.nfbasis([f, "[2,2; %s ,2]"%p ])
3681
+ [1, 1/10000000019*x]
3682
+ >>> pari.nfbasis([f, [2,p]])
3683
+ [1, 1/10000000019*x]
3689
3684
"""
3690
3685
cdef Gen t0
3691
3686
cdef GEN g0
@@ -4115,38 +4110,6 @@ cdef class Gen(Gen_base):
4115
4110
sig_on()
4116
4111
return new_gen(factorpadic(self .g, t0.g, r))
4117
4112
4118
- def poldegree (self , var = None ):
4119
- """
4120
- Return the degree of this polynomial.
4121
- """
4122
- sig_on()
4123
- n = poldegree(self .g, get_var(var))
4124
- sig_off()
4125
- return n
4126
-
4127
- def polisirreducible (self ):
4128
- """
4129
- f.polisirreducible(): Returns True if f is an irreducible
4130
- non-constant polynomial, or False if f is reducible or constant.
4131
- """
4132
- sig_on()
4133
- t = polisirreducible(self .g)
4134
- clear_stack()
4135
- return t != 0
4136
-
4137
- def polroots (self , unsigned long precision = 0 ):
4138
- """
4139
- Complex roots of the given polynomial using Schonhage's method,
4140
- as modified by Gourdon.
4141
- """
4142
- sig_on()
4143
- return new_gen(cleanroots(self .g, prec_bits_to_words(precision)))
4144
-
4145
- def rnfisnorm (self , T , long flag = 0 ):
4146
- cdef Gen t0 = objtogen(T)
4147
- sig_on()
4148
- return new_gen(rnfisnorm(t0.g, self .g, flag))
4149
-
4150
4113
def ncols (self ):
4151
4114
"""
4152
4115
Return the number of columns of self.
@@ -4699,20 +4662,14 @@ cpdef Gen objtogen(s):
4699
4662
4700
4663
Conversion from reals uses the real's own precision:
4701
4664
4702
- >>> a = pari(1.2); a, a.type()
4703
- (1.20000000000000, 't_REAL')
4704
- >>> import sys
4705
- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32'
4706
- >>> a.precision() == (4 if bitness == '32' else 3)
4707
- True
4665
+ >>> a = pari(1.2); a, a.type(), a.bitprecision()
4666
+ (1.20000000000000, 't_REAL', 64)
4708
4667
4709
4668
Conversion from strings uses the current PARI real precision.
4710
4669
By default, this is 64 bits:
4711
4670
4712
- >>> a = pari('1.2'); a, a.type()
4713
- (1.20000000000000, 't_REAL')
4714
- >>> a.precision() == (4 if bitness == '32' else 3)
4715
- True
4671
+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4672
+ (1.20000000000000, 't_REAL', 64)
4716
4673
4717
4674
Unicode and bytes work fine:
4718
4675
@@ -4725,11 +4682,10 @@ cpdef Gen objtogen(s):
4725
4682
4726
4683
>>> pari.set_real_precision(35) # precision in decimal digits
4727
4684
15
4728
- >>> a = pari('1.2'); a, a.type()
4729
- (1.2000000000000000000000000000000000, 't_REAL')
4730
- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32'
4731
- >>> a.precision() == (6 if bitness == '32' else 4)
4732
- True
4685
+ >>> a = pari('Pi'); a, a.type(), a.bitprecision()
4686
+ (3.1415926535897932384626433832795029, 't_REAL', 128)
4687
+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4688
+ (1.2000000000000000000000000000000000, 't_REAL', 128)
4733
4689
4734
4690
Set the precision to 15 digits for the remaining tests:
4735
4691
0 commit comments