login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #405 ContinuedFraction and Polynomial Domains revision 1 of 7

1 2 3 4 5 6 7
Editor: kratt6
Time: 2007/12/05 06:41:43 GMT-8
Note:

changed:
-
Consider

\begin{axiom}
 d := continuedFraction(0,[1 for i in 1..], [1 for i in 0..])$CONTFRAC INT
 2*d
\end{axiom}

so far, so good.  But changing the domain to 'CONTFRAC UP(x, FRAC INT)' makes axiom crash.

The problem appears to be, that 'INT' is ordered, while 'UP(x, FRAC INT)' is not.  In contfrac.spad we find::

    eucWhole(a: Q): R == numer a quo denom a

    eucWhole0(a: Q): R ==
        isOrdered =>
            n := numer a
            d := denom a
            q := n quo d
            r := n - q*d
            if r < 0 then q := q - 1
            q
        eucWhole a

If 'R' is 'INT', 'eucWhole0(4/3)' yields 1, in the other case it returns 4/3. I haven't been able to investigate further yet, though.

Martin

Submitted by : kratt6 at: 2007-12-05T06:41:43-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

Consider

axiom
d := continuedFraction(0,[1 for i in 1..], [1 for i in 0..])$CONTFRAC INT 2*d The constructor INT takes 0 arguments and you have given 1 .

so far, so good. But changing the domain to CONTFRAC UP(x, FRAC INT) makes axiom crash.

The problem appears to be, that INT is ordered, while UP(x, FRAC INT) is not. In contfrac.spad we find:

    eucWhole(a: Q): R == numer a quo denom a

    eucWhole0(a: Q): R ==
        isOrdered =>
            n := numer a
            d := denom a
            q := n quo d
            r := n - q*d
            if r < 0 then q := q - 1
            q
        eucWhole a

If R is INT, eucWhole0(4/3) yields 1, in the other case it returns 4/3. I haven't been able to investigate further yet, though.

Martin