I've been thinking about random elements a bit for p-adics. There are lots of good and reasonable ways to generate random elements of things. For example, in addition to Robert's suggestion, we could have a Gaussian distribution with a specified mean, or a Poisson distribution... It seems like a reasonable way to do it would be to have an algorithm = {uniform, gaussian,...} argument to the random element function and thus have lots available (ie however many we decide to write). Then if someone wants to know what kind of random distributions they can generate, they can just check the docstring for the function. Of course, this still leaves the question of which is the default...
Anyway, I'm planning on doing this for p-adics. Thought I might throw the idea in for integers too. David >It's always bugged me that the default distribution for integers (and >rationals) is just a uniform distribution over some small range. What >if instead we chose the distribution ZZ.random_element() = floor(1/r) >where r is uniformly distributed in (-1,1). Then P(n) = 1 / (2 |n| (| >n| + 1)) for all n in Z-{0}. This gives mostly small numbers with the >occasional large ones thrown in at ever decreasing probabilities. > >A random rational could then be the ratio of two such integers. > >- Robert --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---