Subversion Repositories wimsdev

Rev

Rev 20 | Rev 4158 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
slib_title=Random polynomial
5
slib_parms=4\
6
4,degree\
7
4,range\
8
x, variable\
9
, monic the polynomial is monic,otherwise range of the leading coefficient (sign is permitted)\
10
Z,coefficient ring: Z for the time being,Q,R,C,G (Gauss ring), n (n is an integer for Z/nZ)
11
 
12
slib_author=Bernadette PERRIN-RIOU
13
slib_out=the polynomial
14
slib_comment= by default, the polynomial is a polynomial in x, monic, of degree 4 and with coefficients between -4 and 4 
15
slib_example= 5,6,t,monic\
16
5,6,t,2\
17
5,6,t,-3
3265 bpr 18
slib_require=pari
20 reyssat 19
!exit
20
 
21
:proc
22
 
23
slib_input=$wims_read_parm
24
!distribute items $slib_input into slib_n, slib_m,slib_var,slib_leading,slib_ring
25
!default slib_ring=Z
26
!default slib_n=4
27
!default slib_m=4
28
!default slib_leading=monic
29
!default slib_var=x
30
 
31
!if $slib_leading=monic
32
	slib_leading=1
33
!endif
34
slib_out=!exec pari slib_s=sign($slib_leading); slib_V=vector($slib_n+1,i,random(2*$slib_m)-$slib_m); slib_V[1]=slib_s*(random(abs($slib_leading))+1);print(Pol(slib_V,$slib_var))