On Oct 15, 2007, at 4:47 PM, Steffen wrote:

>
> Hi,
>
> I need to create a random multivariate polynomial. I do it as follows:
>
> F = GF(10007)['x,y'].random_element(4,9)
>
> Now, sage creates a polynomial in x and y of degree 2 in every
> variable, since 4 = 2+2. Furthermore 9 restricts the polynomial to 9
> coefficients. I could not find any documentation for
> "random_element(..,..)" but thats my guess after tinkering around with
> the values. So far everything is perfect.

For the record, you can find out about this kind of thing in SAGE  
using the "?" and "??" operators:

sage: PF9.<a,b>=GF(9,'z')['a,b']
sage: PF9.random_element?
             Return a random polynomial in this polynomial ring.

             INPUT:
                 degree -- maximum total degree of resulting polynomial
                 terms  -- maximum number of terms to generate

                 OUTPUT: a random polynomial of total degree degree
                         and with term terms in it.
             ...

"??" will give you this together with the corresponding code.

There are some glitches in the system, but it works pretty well.


> The problem is now, that most of the time the created polynomial has
> only 6 or 7 coefficients. Since the probability to choose 0 in the
> field GF(bigPrime) is quite low, I would expect the polynomial to have
> 9 coefficients in most cases. If I increase this second parameter of
> the random_element function, the average number of coefficients
> increases up to the maximum possible number of coefficients, which is
> 9. Unfortunately, the computation time for creating the polynomial
> increases nearly linearly with the second parameter of the
> "random_element" function.
> So I am wondering if my understanding of the parameters of
> "random_elment" is wrong or if this function really produces such
> results, which I do not regard as random behaviour.

Check out the code, and ask if this doesn't answer your questions.

HTH

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds
--------
Men are from Earth.
Women are from Earth.
    Deal with it.
--------




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to