Sage FAQ: Frequently Asked Questions







sage -t  devel/sage-main/sage/libs/pari/gen.pyx
python(4563) malloc: *** vm_allocate(size=4096000000) failed (error code=3)
python(4563) malloc: *** error: can't allocate region
python(4563) malloc: *** set a breakpoint in szone_error to debug











# These comments are hints to Sage/Pyrex about the compiler and
# libraries needed for the Givaro library:
#
#clang c++ 
#clib givaro gmpxx gmp m stdc++

cimport sage.rings.finite_field_givaro

# Construct a finite field of order 11.
cdef sage.rings.finite_field_givaro.FiniteField_givaro K
K = sage.rings.finite_field_givaro.FiniteField_givaro(11)

print "K is a", type(K)

print "K cardinality =", K.cardinality()

# Construct two values in the field:
cdef sage.rings.finite_field_givaro.FiniteField_givaroElement x
cdef sage.rings.finite_field_givaro.FiniteField_givaroElement y
x = K(3)
y = K(6)

print "x is a", type(x)
print "x =", x
print "y =", y
print "x has multiplicative order =", x.multiplicative_order()
print "y has multiplicative order =", y.multiplicative_order()
print "x*y =", x*y

# Show that x behaves like a finite field element:
for i in range(1, x.multiplicative_order() + 1):
    print i, x**i


assert x*(1/x) == K.one_element()

To find out more, type sage.rings.finite_field_givaro.FiniteField_givaro. at the Sage prompt and hit tab, then use ?? to get more info on each function. For example:

sage.rings.finite_field_givaro.FiniteField_givaro.one_element??

tells you more about the multiplicative unit element in the finite field.


/bin/login -f sage

and make this file executable; then edit /etc/event.d/tty1, comment out

respawn /sbin/getty 38400 tty1

and add

respawn /sbin/getty -n -1 /usr/bin/autologin 38400 tty1

Now every time the appliance reboots, it will automatically load directly to the sage: prompt. Warning: This will make it nearly impossible to get a terminal prompt! So only do this if you don't plan on any further management.


ToDo