# SageMath resources for Linear and Abstract Algebra (Advanced)

Canvas EdStem Math2922 On-line resources Sage in Ed Weekly quizzes

SageMath is a free open-source mathematics software system, which is based on python. Anything that you can do in python you can do in Sage, so you can think of Sage as being python on steroids. Sage is very powerful, partly because it can interface and use most of the software that is used in mathematics and statistics.The use of Sage in MATH2922 is not mandatory and it is not examinable, however, it is not unlikely that material covered in the sage notebooks will appear in the final exam This said, learning to use SageMath, or python, will almost certainly be to your advantage because it makes some calculations much easier. As a result, it will be easier to visualise what is going on so the mathematics becomes easier to understand. For example, even though doing calculations with row operations can be enlightening, at some point it becomes tedious. By using sage you will be able to concentrate on the ideas underpinning the mathematics rather than getting caught up on mechanical computational details.

We are not going to assume that you know how to program and will instead teach you how to use Sage by using Jupyter notebooks that will gently guide you through what you need to do.

## Accessing sage

There are several easy ways to access Sage:- Log onto EdStem and open a
*WorkSpace*by pressing the >_ navigation icon in the top right-hand corner. Create a*New workspace*of*Type*Jupyter. Finally, create a new notebook running Sage 8.1. - Install SageMath on your own computer by going to
SageMath downloads. Once
is installed, if sage opens in a terminal window then type
*notebook()*to access the web interface. - Use CoCalc which is a commercial Sage server that runs over the internet. Create a free account to use Sage. Paid subscriptions are also possible, but the free version should be sufficient most of the time.

## Documentation and references

There is extensive on-line documentation on using SageMath available on the web. Some useful resources are:- SageMath on-line documentation. See also the SageMath Help and support site
- Sage Quick Reference Cards. In particular, see quickref-linalg and quickref-algebra
- SageMath Feature Tour
- A Jupyter Notebook from a SageMath tutorial, by David Lowry-Duda
- Sage For Undergraduates, by Greg Bard
- A first course in linear algebra, by Rob Beezer

## On-line help

## Accessing the Sage notebooks from Ed

- Log onto Ed
- Click on the workspace icon >_ in the top righthand corner.
- Click on the "Public" link and then on the link that appears
- Select the notebook that you want by ticking the corresponding box:

- Press the "fork" icon in the top righthand corner
- Confirm that you want to "fork" the notebook and you will have your own copy of it to can read and edit

## Trusting notebooks

By default all jupyter notebooks are "untrusted", so you will see button in the top right hand corner of your browser:

You will not be able to run the code in the notebook until you have declared
that it is trusted. This is because there could, potentially, be malicious code in the notebook. If you click on the "Not trusted" link you can make the notebook trusted. Of course, linear algebra is always trustworthy!

## Creating your own notebooks

Create your own jupyter noteboooks in Ed as follows:- Log onto Ed
- Click on the workspace icon >_ in the top righthand corner.
- If you already have a jupyter workspace then click on it. Otherwise, create
a New workspace.
*The type of the workspace should be jupyter*(not sage!). - As in theimage in Step 4 above, click on the button and create a notebook with a SageMath 8.1 kernel to start a new notebok.
- Any notebook that you create yourself is automatically trusted.

## Opening Jupyter notebooks on your own computer

If you install your own copy of sagemath then the easiest way to start a jupyter notebook is to open up a terminal window and type:sage -n jupyterfrom the command-line. I actually use

sage -n jupyter --notebook-dir=~andrew/Math2922/Notebooks &because I keep all of my math2922 notebooks in the directory Math2922/Notebooks (and I have defined a bash alias for this so that I don't have to type all of this ).

If you have only installed a sage executable or app (on windows or a mac, respectively) then when you click on it sage will opens up in its own terminal window. You *should* be able to start a jupyter notebook from here by prefixing the commands above with !:

sage: ! sage -n jupyter[I am not able to test this as I don't have an app for sage installed, so let me know if this does not work.]

Again, you can add * --notebook-dir=path to your notebooks* if you only
want to load notebooks from a particular directory.

Once you have started the jupyter notebook sever, point your favourite web browser at http://localhost:8888 to see the notebooks. I find that chrome works best.