Karim Belabas on Thu, 05 Jul 2012 15:16:52 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Hello


* Ahmad Kamal [2012-07-05 13:47]:
> thanks alot i have tried it and it worked well,  but i want to ask another
> 2 questions please:
> 
> 1- what if i want to guarantee that the polynomial to be of degree m not
> less than that.?

x^m + random(A*x^(m-1))  \\ monic polynomial 

or even

(1 + random(A-1)) * x^m + random(A*x^(m-1))  \\ general polynomial

You may want to subtract (A>>1)*(x^(m-1)-1) / (x-1) to get positive
and negative coefficients

> 2- how can i get n polynomials ( f1(x), f2(x) , ...,fn(x)......etc)?

? f(m, A = 100) = (1 + random(A-1)) * x^m + random(A*x^(m-1));
? n = 5;
? m = 3;
? vector(n, i, f(m))
%4 = [11*x^3 + 91*x^2 + 53*x + 46, 80*x^3 + 85*x^2 + 5*x + 55, 3*x^3 + 68*x^2 + 62*x + 81, 36*x^3 + 24*x^2 + 60*x + 38, 28*x^3 + 25*x^2 + 15*x + 81]

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`