#9705: trouble with long lines in notebook magma mode
-----------------------------+----------------------------------------------
   Reporter:  nbruin         |       Owner:  was            
       Type:  defect         |      Status:  positive_review
   Priority:  major          |   Milestone:  sage-4.7       
  Component:  notebook       |    Keywords:                 
     Author:  William Stein  |    Upstream:  N/A            
   Reviewer:  Martin Raum    |      Merged:                 
Work_issues:                 |  
-----------------------------+----------------------------------------------
Changes (by newvalueoldvalue):

  * status:  needs_review => positive_review
  * reviewer:  => Martin Raum
  * author:  => William Stein


Old description:

> The following are three cells in a magma-mode notebook worksheet,
> together with output (there should be none). Each is valid magma code,
> but the first one produces an error. The other two examples show that
> shortening the line by changing its content or by placing a line break
> make the error go away.
> {{{
> _<x>:=PolynomialRing(Rationals());
> repeat
>   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where
> b:=Random([-10..10]) where c:=Random([-10..10]);
> until Roots(g) ne [];
> ///
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "_sage_input_6.py", line 10, in <module>
>     exec compile(u"print _support_.syseval(magma,
> u'_<x>:=PolynomialRing(Rationals());\\nrepeat\\n
> g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where
> b:=Random([-10..10]) where c:=Random([-10..10]);\\nuntil Roots(g) ne
> [];', __SAGE_TMP_DIR__)" + '\n', '', 'single')
>   File "", line 1, in <module>
>
>   File "/usr/local/sage/4.4.4/local/lib/python2.6/site-
> packages/sagenb-0.8-py2.6.egg/sagenb/misc/support.py", line 473, in
> syseval
>     return system.eval(cmd, sage_globals, locals = sage_globals)
>   File "/usr/local/sage/4.4.4/local/lib/python2.6/site-
> packages/sage/interfaces/magma.py", line 523, in eval
>     raise RuntimeError, "Error evaluating Magma code.\nIN:%s\nOUT:%s"%(x,
> ans)
> RuntimeError: Error evaluating Magma code.
> IN:_<x>:=PolynomialRing(Rationals());
> repeat
>   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where
> b:=Random([-10..10]) where c:=Random([-10..10]);
> until Roots(g) ne [];
> OUT:
>
> >> load
> "/home/nobody/.sage//temp/ella.cecm.sfu.ca/21960//interface//tmp21960"
>    ^
> User error: bad syntax
>
> >> until Roots(g) ne [];
>    ^
> User error: bad syntax
> }}}
>
> {{{
> _<x>:=PolynomialRing(Rationals());
> repeat
>   g:=x^3+b*x+c where b:=Random([-10..10]) where c:=Random([-10..10]);
> until Roots(g) ne [];
> ///
> }}}
>
> {{{
> _<x>:=PolynomialRing(Rationals());
> repeat
>   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2
>      where b:=Random([-10..10]) where c:=Random([-10..10]);
> until Roots(g) ne [];
> ///
> }}}

New description:

 The following are three cells in a magma-mode notebook worksheet, together
 with output (there should be none). Each is valid magma code, but the
 first one produces an error. The other two examples show that shortening
 the line by changing its content or by placing a line break make the error
 go away.
 {{{
 _<x>:=PolynomialRing(Rationals());
 repeat
   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where
 b:=Random([-10..10]) where c:=Random([-10..10]);
 until Roots(g) ne [];
 ///
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "_sage_input_6.py", line 10, in <module>
     exec compile(u"print _support_.syseval(magma,
 u'_<x>:=PolynomialRing(Rationals());\\nrepeat\\n
 g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where b:=Random([-10..10])
 where c:=Random([-10..10]);\\nuntil Roots(g) ne [];', __SAGE_TMP_DIR__)" +
 '\n', '', 'single')
   File "", line 1, in <module>

   File "/usr/local/sage/4.4.4/local/lib/python2.6/site-
 packages/sagenb-0.8-py2.6.egg/sagenb/misc/support.py", line 473, in
 syseval
     return system.eval(cmd, sage_globals, locals = sage_globals)
   File "/usr/local/sage/4.4.4/local/lib/python2.6/site-
 packages/sage/interfaces/magma.py", line 523, in eval
     raise RuntimeError, "Error evaluating Magma code.\nIN:%s\nOUT:%s"%(x,
 ans)
 RuntimeError: Error evaluating Magma code.
 IN:_<x>:=PolynomialRing(Rationals());
 repeat
   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2 where
 b:=Random([-10..10]) where c:=Random([-10..10]);
 until Roots(g) ne [];
 OUT:

 >> load
 "/home/nobody/.sage//temp/ella.cecm.sfu.ca/21960//interface//tmp21960"
    ^
 User error: bad syntax

 >> until Roots(g) ne [];
    ^
 User error: bad syntax
 }}}

 {{{
 _<x>:=PolynomialRing(Rationals());
 repeat
   g:=x^3+b*x+c where b:=Random([-10..10]) where c:=Random([-10..10]);
 until Roots(g) ne [];
 ///
 }}}

 {{{
 _<x>:=PolynomialRing(Rationals());
 repeat
   g:=3*b*x^4+18*c*x^3-6*b^2*x^2-6*b*c*x-b^3-9*c^2
      where b:=Random([-10..10]) where c:=Random([-10..10]);
 until Roots(g) ne [];
 ///
 }}}

 '''Apply:'''
   1. trac_9705.patch

--

Comment:

 This looks good for; Tests are OK.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9705#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to