2007/10/26, Steffen <[EMAIL PROTECTED]>:
> 1) Polynomial with max number of monomial. We dont need to worry about
> that case, since here all the monomial are chosen, that means actually
> there is nothing to choose. So this will be efficient anyway.
> 2) A user wants an exact < totalmax number of monomials. In this case
> its difficult to reach real randomness in an efficient way. Martins
> and my proposal in this case was to except collisions during the
> implementation, that is choose a random monomial and throw it away if
> already chosen. This is not most efficient, the expectation
> calculation period has 2 * the optimal time as upper bound.
> 3) A user wants a real random polynom with a certain number of
> monomials, but there is no need to fix a maximum number of monomials.
> An efficient implementation here would be:
> #m = maxNumberOfMonomials = "calculate it"
> #d = desiredNumberOfMonomials = "choose it"
> Iterate over the list of all monomials, with probability #d/#m choose
> this monomial.
> This would be faster than 2) and would return a polynomial with an
> expectation value of monomials of #d

Could you give an example for each of these cases? I'm having trouble
distinguishing the difference between 2) and 3)

Mike, your code had a subtle bug, where
random_monomials(n,degree,terms) failed each time for degree =1 (but
was fine for degree=0).

didier

--~--~---------~--~----~------------~-------~--~----~
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