-
Notifications
You must be signed in to change notification settings - Fork 49
Using SageMath
SageMath is an open source alternative to the closed source applications Maple, Mathematica and Matlab, which allow you to do symbolic algebra (and much, much more). It is slightly more limited in its functionality, but it has the advantage of an open source community, and because its code is open source, you can really understand how and what it is doing, unlike something like Mathematica where you cannot see what it is doing "beneath the hood" because it is proprietary.
We will use CoCalc to run SageMath notebooks where needed. You should set up a (free) profile there so that you can save things and come back to your projects.
Set up a project (maybe named MTH739), and add a SageMath notebook (similar to a Jupyter notebook, but with more functionality). If you get stuck, a ChatGPT prompt is built in to help you!
In the SageMath notebook prompt type
u = var('u')
diff(sin(u), u)
And shift-enter to execute. This should return cos(u), showing that it is working correctly.
You should have previously added conda-forge using:
conda config --add channels conda-forge
Now install sage by doing:
conda install sage
You can either do this in your virtual environment, or just do a general install on your machine if you think SageMath will be something you use frequently. Further details can be found here, but you should not need them.
Once installed, try to open a sagemath jupyter notebook using the terminal command
sage -jupyter notebook
Create a new SageMath notebook (click on New in the top right of the jupyter notebook interface, and select a SageMath notebook). In the prompt type
u = var('u')
diff(sin(u), u)
And shift-enter to execute. This should return cos(u), showing that it is working correctly.
Copyright K Clough/QMUL 2023