Friday 14 December 2012

Installing Sage Mathematics on a Windows machine

Introduction:

Sage maths is an open-source mathematics package that rivals Mathmatica in function and power.

From it's website (sagemath.org):
"Sage is built out of nearly 100 open-source packages and features a unified interface. Sage can be used to study elementary and advanced, pure and applied mathematics. This includes a huge range of mathematics, including basic algebra, calculus, elementary to very advanced number theory, cryptography, numerical computation, commutative algebra, group theory, combinatorics, graph theory, exact linear algebra and much more. It combines various software packages and seamlessly integrates their functionality into a common experience. It is well-suited for education and research."

This article describes how to install and run sage math on a Microsoft computer.



Install Emulator and Image

Sage math is built on a lot of packages, unfortunately most of which are only available on Linux. Efforts are underway to port sage math to windows, but in the meantime, you will want to run sage math inside an emulator.

  1. Download and install VirtualBox from www.virtualbox.org/wiki/Downloads
  2. Download the current sage math virtualbox image from the University of Sydney mirror. (Grab the latest file that ends with .ova).
  3. Open the VirtualBox program, and import the sage math image by clicking 'File', then 'Import Appliance'.
  4. Once VirtualBox finishes importing the image, you can start sage math by double-clicking on Sage-5.x in VirtualBox. If sage math asks for a user and a password, type admin for user and sage for password (Or depending on the release, sage and sage for both password and username).
Sage math runs a server and a Web-based graphical user interface. You can use the interface from within VirtualBox, but you can't copy-paste to other programs. The next section shows how to access the interface from your machine's normal web browser.

Resetting Local Port Address

As mentioned, sage math runs as a server that you can access by pointing your normal browser at localhost:8000 (or 127.0.0.1:8000).
However, when I first wrote this article, it was intended for fellow Education Queensland teachers who were using government-supplied laptops, which ran a piece of software called BlueCoat Proxy. This program already claimed port 8000, conflicting with Sage Math rather badly.
It is possible to reset the image's port address, this involves changing some settings in the VirtualBox software.

  1. In the running Sage-x.x window, click on the menu "Devices", then click on "Network Adaptors", then click on the button at the bottom called "Port Forwarding".
  2. There is an entry under Host Port with the number 8000. Change that to 8080. Leave the Guest Port number for that line as 8000. CLick on "OK" twice.
  3. This should take you back to the sage math image (which looks like a wall of text). In the menu "Machine", click on "ACPI Shutdown" to shut the sage math image down.

Running the Software

You will want to open your desktop browser to 127.0.0.1:8080. If it asks you to log in, you will need to use admin for the username and sage for the password. (Or sometimes sage and sage depending on who built the image).

Running from the desktop browser means that you will be able to copy equations from Sage and place them in Microsoft Office 2010+, as well as images.
It also enables you to download/upload sage files from/to the virtual server, an important feature as you upgrade the virtual image.

Sage math is now installed and correctly configured, and ready to run. A good place to start learning sage math is the tutorial available at:
http://sagemath.org/doc/tutorial/tour.html
Sage is based on a computer language called Python that is wonderfully easy to learn. Make sure to activate the "typeset" option box once you create a new page to get pretty equations.

No comments:

Post a Comment