On Jan 15, 2008 7:24 AM, Kiran Kedlaya <[EMAIL PROTECTED]> wrote: > > In Magma, many commands return multiple values, for instance: > > sage: %magma > magma: XGCD(15, 10) > 5 1 -1 > > However, the following happens in SAGE: > > sage: magma.XGCD(15, 10) > 5 > > Is there a good way for the Magma interface to detect multiple return > values and bundle them into a Python tuple? Then I'd be able to say > > sage: x, y, z = magma.XGCD(15, 10) > > and have now x == 5, y == 1, z == -1.
That is impossible and never will happen. In Magma functions can behave *differently* depending on how many return values you request, e.g., > x, y := Foo(Bar); can behave 100% differently than > x := Foo(Bar); Depending on your taste this is either brilliant or stupid. I won't say which I think it is. Anyway, the solution in Sage is the nvals option to any Magma function: sage: magma.XGCD(2,3,nvals=3) (1, -1, 1) sage: magma.XGCD(2,3,nvals=1) 1 sage: magma.XGCD(2,3,nvals=2) (1, -1) See the appropriate section here: http://sagemath.org/doc/html/ref/module-sage.interfaces.magma.html William --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---