Starting up with SageMath
Working with SageMathCloud.
SageMathCloud is the easiest way to start working with SageMath. (Though, if you are feeling more adventurous, you could also install Sage on your computer following directions here.)
Steps to get going with SageMathCloud:
-
You need to be using either Google Chrome or Safari. Unfortunately, Firefox does not work.
-
Create an account on https://cloud.sagemath.com.
You just need your name, email address and a password. After entering this information
-
You should now be brought to a page where you can create a new project (which is like a directory on the server for storing your work with SAGE). Enter a title such as "Dynamics Class". You don't need a description. Click "Create Project". (The other buttons involve adding features you do not, and the site charges for these features.)
You will be brought to the Project page.
-
Important: Observe that in the top right corner of the worksheet, it says Python 2 (SageMath). This means this is a python notebook and not a sage notebook. To fix this click on the Kernel menu, then move down to Change kernel and click SageMath 7.5 (or whatever the latest version of SageMath is).
-
Click on the button ⊕New. Replace the name (which defaults to the current date and time) with something reasonable like "First Notebook". Then under "Select the type" click the button for "Jupyter Notebook". The page should update to allow you to view the notebook.
- Playing around with a first notebook:
- There should be a line which reads
In [ ]:
and a text box after it. Click on the text box and type 2+3
. Then hold down Shift and press enter. A line reading Out[1]: 5
should appear.
- We'll now create the function $f(x)=x^2$. Enter
f = lambda x: x**2
in the next textbox (after In [ ]:
). The notation lambda x: x**2
represents the function $x$ maps to $x^2$ and with **
representing exponentiation. Then hold down Shift and press enter.
- In the next textbox type
f(2)
and press Shift+Enter. You should see something like Out[3]: 4
.
- Now type
plot(f,0,1)
. You should see a graph appear:
To find out more about the plot function, you can type plot?
and hit Shift+Enter.
- If you feel motivated to play around more with the basics of Sage, take A Guided Tour. It seems like it would be useful to work through the topics of this page up through Some Common Issues with Functions.
-
To do something related to the course, you can visit the Cobweb plot notebook I created.
You can not edit or manipulate this page. But, you can copy the notebook to your project and then manipulate it. Click the button labeled Copy Jupyter Notebook to your Project.... Then under In the project select the project you just created and click Copy 1 item. Then go back to your project (possibly by entering cloud.sagemath.com into your browser and clicking on your project). You should now have a file named
Cobweb.ipynb
. Click on this file name. You can now select the text boxes one at a time and press Shift+Enter to run them. (This must be done in order or you'll likely get errors.) Later in the notebook sliders and interactive graphics should be created. You should play around with these things. For example, you could try to study the family of maps $T_c(x)=c \cos(x)$ defined on the interval $[-c,c]$. This function can be represented by the code lambda x:c*cos(x)
.
Course webpage | Course Information for SageMath