Sage FAQ: Frequently Asked Questions

TableOfContents

1. Introduction

1.1. What is Sage?

Sage is a comprehensive open-source mathematics software suite that has the mission statement "Creating a viable free open source alternative to Magma, Maple, Mathematica, and Matlab." See http://www.sagemath.org/ for more details.

2. Getting Sage

2.1. Can I try out Sage without downloading anything?

Yes! Go to http://www.sagenb.org/ and set up a free account. If you log in, you will be working on a free Sage notebook server that will work identically to the one you get with Sage.

2.2. How do I get a Sage program I can run immediately?

Go to http://sagemath.org/download.html and click on the link for the binary for your operating system.

2.3. How do I get the Sage source code?

Go to http://sagemath.org/dist/src/index.html to download the tar archive for any release of Sage.

2.4. How do I get a previous release of Sage?

Go to http://sagemath.org/dist/src/index.html to download the tar archive for any release of Sage.

3. Installing and running Sage

3.1. How do I use the notebook with Firefox 3.0 beta 5?

There is [https://bugzilla.mozilla.org/show_bug.cgi?id=427081 a bug in Firefox 3.0 beta 5] that causes it to reject connections to the Sage notebook with the error "Certificate key usage inadequate for attempted operation. (Error code: sec_error_inadequate_key_usage)". This will be fixed in Firefox 3, but for now one solution is to use a different browser, such as Firefox 2, Konqueror, Safari, Opera, or even Internet Explorer. Another solution is to run the notebook in insecure mode by using the command inotebook() instead of notebook(); then Firefox 3.0b5 will work.

3.2. How do I compile the source to Sage?

Download the source tar archive, extract the archive, change your directory to be inside of it, and read the README.txt file there. Basically, after making sure you have the proper prerequisite tools installed, you type make.

3.3. How do I run Sage on a platform other than VMWare or Windows?

Change your directory to the sage directory and run ./sage

To start an online notebook server, start Sage and type notebook() at the sage command prompt.

3.4. How do I run Sage with VMWare?

You must install the VMWare software (the free VMWare Player should work). Simply start the virtual machine using the VMWare software, wait for the virtual machine to boot up, then type notebook at the prompt.

3.5. How do I run Sage in Windows?

Windows is currently supported via the VMWare image, so see the instructions for running Sage under VMWare.

3.6. How do I run a parallel build?

export MAKE="make -j8" will enable 8 threads for parts of the build that support parallelism.

4. Developing in Sage

4.1. What tools do I need to develop in Sage?

You need the prerequisite tools listed in the README.txt file in the root directory of Sage.

4.2. Where is the source code to Sage?

You can browse the complete source code to everything in Sage at http://www.sagemath.org/hg/. This is a web interface to the Mercurial repository. The main source files are at http://www.sagemath.org/hg/sage-main?cmd=manifest;manifest=-1;path=/sage/. The other directories include docs directories, the package system, etc.

5. Getting help

5.1. How do I get help?

Sage has two very active email lists: http://groups.google.com/group/sage-devel and http://groups.google.com/group/sage-support. There are also two very active IRC channels: #sage-devel and #sage-support on freenode. Many developers also actively blog and also post other Sage-related tutorials and talks. See http://sagemath.org/community.html for a listing of these resources.

6. Other questions


sage: from scipy import stats
sage: RealNumber=float
sage: stats.ttest_ind(list([1,2,3,4,5]),list([2,3,4,5,.6]))
(array(0.076752955645333687), 0.940704902474)







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.



There are several ways to define a function: xor = lambda x, y: x.__xor__(y) and then do xor(3, 8). Another option, which sneaks around the Sage preparser, is def xor(a,b):  return eval("%s^%s"%(a,b)). You can also turn off the Sage preparser with preparser(False) -- then ^ will work just like in Python, and you can later turn on the preparser with preparser(True). (That only works in command-line Sage; in a notebook, switch to Python mode.)


ToDo