On Thu, Mar 19, 2015 at 9:20 AM, William Stein <[email protected]> wrote:
> On Thu, Mar 19, 2015 at 9:11 AM, Robert Bradshaw <[email protected]> wrote:
>> On Thu, Mar 19, 2015 at 3:16 AM, Chris Wuthrich
>> <[email protected]> wrote:
>>>
>>>> What about the quadratic case? Would you oppose change the print order
>>>> just for quadratic number fields (note that we already have a separate 
>>>> class
>>>> QuadraticNumberField, so the change can easily be made).
>>>
>>> And a further subquestion: What about Q[i] ? It seems really strange that
>>> sage decides to write 3*I + 1. But reverts it for CC(3*I+1).
>>> No other cas does that, I would think.
>>
>> Yes, I was also referring specifically to to the special case of QQ[i],
>>
>>     sage: R.<I> = QQ[sqrt(-1)]
>>     sage: 3 + R.gen()
>>     I + 3
>>     sage: CC(3 + R.gen())
>>     3.00000000000000 + 1.00000000000000*I
>>
>> which Maple and Mathematica handle this case differently (better) than
>> arbitrary number fields.
>
> Can you illustrate your claims about Maple and Mathematica with actual
> Maple and Mathematica sessions?

http://www.maplesoft.com/support/help/maple/view.aspx?path=complex
http://www.wolframalpha.com/input/?i=sqrt%28-1%29+%2B+2

>> For numerical complex numbers, Pari also does
>>
>>     sage: pari(CC(1.0, 2.0))
>>     1.00000000000000 + 2.00000000000000*I
>>
>> and its "number field element" representation of Mod(poly1, poly2)
>> isn't very compelling.
>
> Well I certainly don't like it either.  However for a system like pari
> where the output representation of elements determines the object, it
> is the best possible choice.   It would be crazy if it were written
> Mod(reversed poly1, poly2).

Yes, this is consistent with Pari's representation of objects.

>> Broadening the scope it seems more natural for cyclotomic fields and
>> quadratic fields as well
>>
>>     sage: S = QQ[sqrt(5)]
>>     sage: 2 + S.gen()
>>     sqrt5 + 2
>>
>>     sage: R = CyclotomicField(5)
>>     sage: (R.gen() + 1)^5
>>     5*zeta5^3 + 5*zeta5^2 - 3
>>
>> I actually don't think it'd be that bad to print out algebraic number
>> representations in reverse order than polynomials; that's what we do
>> for power series (for admittedly even more compelling reasons).
>
> I think every single math software system there is prints power series
> from lowest to highest degree.

Yes. My point was that while this is inconsistent with how polynomials
print, it's still the right choice in that context.

>> But mine is just one of many opinions.
>
> I think a really compelling argument that is more than just an opinion
> is really important when changing something that will be noticed.  For
> example, this will break many of the doctests in my algebraic number
> theory book...

True, but people aren't generally testing the doctests in your book.
The files we test would get changed, and people typing examples out of
the book wouldn't be too weirded out getting 1 + I instead of I + 1.
So I do think it largely (though not entirely) boils down to a matter
of preference.

If there's a lot of automatically-tested code out there that we don't
have any visibility into, that'd be good to know.

> You and I co-authored much of the algebraic number theory
> functionality in the first place and _you_ implemented like 90% of
> QuadraticField.  I wonder, did you think about this exact issue before
> when we were implementing things in the first place?

It bothered me a little when doing the quadratics, but not enough to
change. In particular I was striving for a drop-in replacement for our
generic number field elements (including all doctests passing as is).
I also thought about it when implementing QQ[sqrt(2)], but changing
printing was a bigger change than I wanted to make at the time.

But if people are proposing such a change, I would be supportive. It
doesn't seem many people like the "b*I + a" ordering despite the
reasoning for why it happens to be that way.

> I only remember a similar discussion in Sage coming up once before in
> 2009 when Gary Furnish wrote his "new symbolics", and switched the
> order of printing of polynomials to be from low to high degree, as is
> done in Mathematica, but nowhere else in math (e.g., the quadratic
> would be written c + b*x + ax^2).  People weren't pleased with that
> suggested change at the time...

Yeah, I do remember that.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-nt" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
Visit this group at http://groups.google.com/group/sage-nt.
For more options, visit https://groups.google.com/d/optout.

Reply via email to