14.7.2 Multiple Return Values

Some Magma functions return more than one value. You can control how many you get using the nvals named parameter to a function call:

sage: n = magma(100)
sage: n.IsSquare(nvals = 1)
true
sage: n.IsSquare(nvals = 2)
(true, 10)
sage: n = magma(-2006)
sage: n.Factorization()
[ <2, 1>, <17, 1>, <59, 1> ]
sage: n.Factorization(nvals=2)
([ <2, 1>, <17, 1>, <59, 1> ], -1)

We verify that an obviously principal ideal is principal:

sage: _ = magma.eval('R<x> := PolynomialRing(RationalField())')
sage: O = magma.NumberField('x^2+23').MaximalOrder()
sage: I = magma('ideal<%s|%s.1>'%(O.name(),O.name()))
sage: I.IsPrincipal(nvals=2)
(true, [1, 0])

See About this document... for information on suggesting changes.