On 4/27/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > Yes. That's almost exactly what I proposed above. I prefer > > different function names, since the return results are so > > different, and since there are three options. If it were just > > one could have > > def sqrt(self, exact=True, extend=True): > > ... > > > > but it gets complicated because if exact=False, you also need > > to be able to pass in an optional precision parameter. I think > > I prefer three separate functions: > > sqrt_approx, sqrt, sqrt_exact. > > Having a single function with parameters means one could pass the > parameters on, e.g. in the sqrt function for power series, on needs > to take the square root of the leading coefficient. This would let > one write more generic code. Also, the "global" sqrt could take > parameters too. Perhaps > > def sqrt(self, precision=None, extend=True): > .... > > > I think this would be in addition to the named parameters.
That's a very very good point. I'm convinced. Thanks for counter-argiing this point. > > > sqrt(2) could be an element of the number field K=Q[x]/(x^2-2) > > *equipped* with an embedding map K --> SR that sends x to > > the symbolic ring element sqrt(2). We could also equip K with maps > > to RR, CC, etc., by choosing a root to some precision (which would > > choose a root to any bigger precision automatically). More generally, > > at creation time one could equip any ParentWithGens object with > > a list of embedding morphisms that should be used by the coercion > > system automatically. This list is would be immutable. So there > > would be a new number field class NumberField_with_embedding(s). > > I think this should be an ability of any parent (with gens?), and one > would not necessarily have to create a new class > NumberField_with_embeddings. > > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://www.williamstein.org --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---