On Sep 25, 2008, at 1:19 PM, Georg S. Weber wrote: > Hi, > > On 24 Sep., 15:34, "John Cremona" <[EMAIL PROTECTED]> wrote: >> 2008/9/24 Michel <[EMAIL PROTECTED]>: >> >> >> >>> I think that both pi and I are universal constants in sage. >> >>> sage: zeta_symmetric(pi) >>> 0.583573760763662 >>> sage: zeta_symmetric(1/2) >>> 0.497120778188314 >>> sage: zeta_symmetric(1/2+I) >>> ....exception >>> sage: zeta_symmetric(1/2+CC(I)) >>> 0.485757429670983 - 1.38777878078145e-17*I >> >>> Conclusion: it seems that coercion to a complex >>> number happens for pi but not for I (even though zeta_symmetric >>> expect a complex number as input). >> >> In the code for zeta_symmetric() there is this: >> if not (is_ComplexNumber(s) or is_RealNumber(s)): >> s = RealField()(s) >> >> All we need is to put in a default line s=ComplexField(s) which would >> handle the case of I. Note that >> >> sage: is_ComplexNumber(I) >> False >> >> which is bizarre but logical since the symbolic constant I is not of >> ComplexNumber type. >> >> We might think of replacing the is_ComplexNumber test, currently >> isinstance(x, ComplexNumber) to catch some symbolic constants. But >> this might break a lot of things, so the simpler solution of fixing >> zeta_symmetric and similar functions is probably better. >> >> There have very regularly been queries to sage-support caused by the >> symbolic I not being treated as a number. It would be nice to fix it >> once and for all... >> > > I came across the Sage "I" first when Minh Nguyen posted his > enhancements > of tut.tex som days ago. It was the section about "I", that troubled > me back then. > > Probably I don't understand yet the nature of a "symbolic" in a CAS, > but my > expectations "out of the stomac" for "I" would be: > > 1. It is naturally the "other" generator of the ring of the "Gaussian > Integers", > which should be a built-in feature of any good CAS, just as the > integers, > or the rationals. > So we have "2 * I" and "5 + I" being well defined, without further > notice. > (The "Gaussian Integers" also should naturally know that they e.g. > are a > Euklidean Domain, how prime factorization in them works, and so > on, > but this is a completely different issue.)
Yep, this is what it should be. > 2. There are natural, even automatic, coercions (of "I", but also "2 * > I" and "5 + I") > into > a) the complex numbers CC > b) the rings and fields of p-adic nature, for any odd prime p, > c) the finite fields of characteristic p , > where p is any prime being congruent to 1 mod 4 > d) well, its fraction field, the "Gaussian Rationals" (also > coercible then into CC) > e) ZZ^2 via the "forgetful functor" from rings to abelian groups > f) number fields and orders, which contain the roots of > "-1" (pinning down a choice) > > Wouldn't that be achieved by defining from the start that "I" is the > generator of the > formal ring ZZ[I] / (I^2 + 1), that is the univariate polynomial ring > over the integers > in the variable I, modulo the ideal generated by the polynomial I^2 > +1? > > (Or by an appropriate built-in object, whose "underlying ring" is just > that, > but which additionally "knows" it is a PID, even Euklidean, > cyclotomic, > and what not ...) > > I admit that I do not understand how to implement coercion rules in a > CAS, > let alone automatic coercion, nor how the current state in Sage is / > will be. > > Maybe one has to give "hints" to the coercion code, but if so, > how much work would that be with regard to "I"? One issue is there is a non-canonical choice of embeddings of the Gaussian Integers into each of the rings listed above. One embedding can be specified, which should probably be ZZ[i] -> CC. (More than one embedding and the problem of discovering coercions becomes much too time intensive). What is the canonical choice of embedding into Z/ pZ or Qp though? The "smallest" representative? There's consistency issues to worry about too (though QQ[i] could be specialized more than other number fields). > The main point is that the the above coercion rules do (do they in > Sage?) > do apply to the Sage integers. > So I simply would expect them to work for "I" as well, and even > automagically so. Currently I is in the "Symbolic Ring" which is at the bottom of the coercion chain (i.e. Symbolic Ring element + anything is in Symbolic Ring). > That also was the whole point of Michel, the one who started this > thread ... > > Cheers, > gsw > >> John >> >> >> >>> Michel > > --~--~---------~--~----~------------~-------~--~----~ 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---