On Dec 6, 8:17 am, "William Stein" <[EMAIL PROTECTED]> wrote: > On Fri, Dec 5, 2008 at 10:12 PM, Jason Grout > > > > <[EMAIL PROTECTED]> wrote: > > > Jan Groenewald wrote: > >> Hi > > >> On Thu, Dec 04, 2008 at 11:22:11AM -0600, Jason Grout wrote: > >>>>http://sagenb.org:8000/home/pub/94/and included some timings there. > >>> Nice. > >>> If you use: > >>> R.<j> = QQ.extension(x^2+1) > >>> then the imaginary number prints as "j" instead of "I", which might make > >>> more sense. > > >> I would like to understand, why does this make more sense? > >> Is it just stylistic? > > > The way Mike had it defined, when you typed "j", Sage answered back "I". > > With my construction, when you typed "j", Sage answered back "j"--I > > thought it would be less confusing for students if the letter they typed > > was the letter Sage used. Purely stylistic, though. > > >> Later in the exercise we wish to work with sqrt(2), e.g., > >> and I'm not sure exactly how j can be used. > > > Yes, you run into the same problem with Mike's construction above. > > I*sqrt(2) makes sense, but when j is a number field element in QQ[i], > > apparently Sage can't multiply it by sqrt(2). This would be a reason to > > use the symbolic I instead of the number field element. > > This is because number fields are not currently equipped with an > embedding into CC. This will change in Sage-3.2.2 (somehow). > Anyway, now you can use a relative number field: > > sage: K.<j,b> = QQ[sqrt(-1), sqrt(2)] > sage: j^2 > -1 > sage: b^2 > 2 > sage: j*b > sqrt2*I > sage: (j+b)^3 > 5*I - sqrt2 > sage: timeit('j*b') > 625 loops, best of 3: 9.62 µs per loop > > sage: type(K) > <class 'sage.rings.number_field.number_field.NumberField_relative'> > sage: K > Number Field in I with defining polynomial x^2 + 1 over its base field > sage: K.base_field() > Number Field in sqrt2 with defining polynomial x^2 - 2 > sage: K.base_field().base_field() > Rational Field > > -- William
Hello William, That seems to work great, except for the problem of computing the hermitian conjugate of the unitary matrix u, since sage: K.<j,b> = QQ[sqrt(-1), sqrt(2)] sage: j.conjugate() 0 Can one define a conjugation such that the conjugate of j is -j ? Many thanks! Rafael. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---