Welcome to Math Forum!
So what is Sage? Sage is comprehensive mathematics software that you can use from your computer, or even certain mobile devices.
The first thing we'll want to do is get people started up on Sage. Nothing could be easier.
See this screenshot.
If you ever have trouble during the talk, you can always go and type commands here to your heart's content!
However, this can only handle oneoff computations. There are two options for doing lots of them online.
This last thing is done by clicking in the 'cell' like the one below, typing 2+2, and then either clicking "Evaluate" (or the "Run" button) or pressing Shift and Enter simultaneously (ShiftEnter).
4 4 
If you really want to, you can even "Edit a copy" of this worksheet, located at http://sage.math.gordon.edu/home/pub/86/; once you've logged in, click "Edit a copy", or follow the instructions at http://doc.sagemath.org/html/en/prep/LoggingOn.html.
Once you've done this, the main goal for today is to give you an introduction to how to use Sage, whether or not you are required to use it in a class.
Sage can function as:
Of course, there are many programs which can do that! There are some advantages to Sage, of course:
But those alone would not make it something I would necessarily ask students to use on a regular basis. Here is why I use Sage, and why I often ask my classes to do so:
Now let's get cracking! First, let's recall the three examples on the advertising flyer for the Math Forum. They were from:

As you can see, when you click on a "cell", there is a little 'evaluate' link right below it on the left. You may click on this to ask Sage to do something, or you can press Shift and Enter at the same time. In the case above, I have asked it to define a function of a variable $x$. Notice that exponentiation is denoted with the carat (Shift6) and multiplication with the asterisk (Shift8). Other than this, Sage 'knows' about most math expressions via something called a preparser, but you must do these correctly (especially multiplication!).
You should also notice that nothing appeared to happen when I clicked 'evaluate'. That is because I did not ask Sage to show any output. The last thing I type is the thing that gets displayed, if it is an actual calculation. Here, I just defined something, but didn't calculate it. On the other hand:

Notice that if I check the "Typeset" button at the top, it is nicely typeset, using MathJax, the standard for web mathematics. Surrounding something with "pretty_print()" also will do this.
Now, if I wanted to do everything above all at once, I could have typed the following:

If I want more than one thing to show up at the same time, I put it all on the last line and separate by semicolons, like so:

And now it is a simple matter to do some calculus homework checking. What was the integral of the square root of $x^2+5x+1$ again?

Notice I included the variable; otherwise, how does Sage know I didn't mean an integral with respect to some other variable?
If I want the definite integral, the syntax is similar, and intuitive:

You can numerically approximate things, of course:

Here is what happens if you try to use any variable or constant other than $x$, $e$, or $pi$ without "declaring" it first:
Traceback (click to the left of this block for traceback) ... NameError: name 'y' is not defined Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_13.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# * coding: utf8 *\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW50ZWdyYXRlKHNxcnQoZikseSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmp9p7VIr/___code___.py", line 2, in <module> exec compile(u'integrate(sqrt(f),y) File "", line 1, in <module> NameError: name 'y' is not defined 
But if you do declare it (the syntax is always the same), neat things can happen!

And of course other calculus stuff works, too.

Before we see what else Sage can do, I should point out that you should feel free to just type whatever you can and see what works.
You should especially try to make mistakes and find new commands. How might one do that? There are a few ways to do it:



Before we move on to linear algebra, I wanted to show you some eye candy. Just in case you thought Sage wasn't up to applications.
__main__:1: RuntimeWarning: divide by zero encountered in reciprocal __main__:1: RuntimeWarning: divide by zero encountered in reciprocal 
Click to the left again to hide and once more to show the dynamic interactive window 
Now, those of you in the know noticed that the specific commands I used seem to indicate doing things like matrix inversion and other matrix operations  that is to say, it involves linear algebra! So let's see what Sage can do with linear algebra.



So Sage can pretty easily create matrices and vectors and do things with them. One interesting point here is that vectors are not regarded as $1\times n$ or $n\times 1$ matrices, but as their own entities. Even w*w makes sense, and gives the dot product (the only reasonable interpretation of the product of two vectors).
We can also use it to solve systems of linear equations in this context, for instance

It also tells me if there is not a solution, which certainly can happen!
Traceback (click to the left of this block for traceback) ... ValueError: matrix equation has no solutions Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_31.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# * coding: utf8 *\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QS5zb2x2ZV9yaWdodCh3KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpwU4PZu/___code___.py", line 2, in <module> exec compile(u'A.solve_right(w) File "", line 1, in <module> File "sage/matrix/matrix2.pyx", line 398, in sage.matrix.matrix2.Matrix.solve_right (/usr/local/sage6.9/src/build/cythonized/sage/matrix/matrix2.c:6765) File "sage/matrix/matrix2.pyx", line 516, in sage.matrix.matrix2.Matrix._solve_right_general (/usr/local/sage6.9/src/build/cythonized/sage/matrix/matrix2.c:7924) ValueError: matrix equation has no solutions 
I can also get other things I might want. Remember, type the dot/period and then [tab] to see what options I have:


Notice that most commands are accessed by dot/period and function_name(). This allows Sage to only try to do math on things that deserve it; for instance, you don't want the determinant of a polynomial to be possible! What would that even mean?
We can do more complicated things if we tell Sage that we are allowing noninteger values:

Or to the end of your spring course!


Differential equations can be nicely modeled too. Here is a slope field, just for you!

It is possible to even plot solutions, solve numerically, get exact answer, etc., depending on how hard they are:


If you know how to ask a little more of Sage, you can define your own interactive demos. This is not too hard, but does require you to be able to follow the examples given in interact? fairly closely.
Click to the left again to hide and once more to show the dynamic interactive window 
Of course there is a lot more to math than just this! In fact, Sage's greatest strong suit is in things like highprecision numerical computing, number theory and abstract algebra, because that is the roots of its founders. But the examples I've shown you are all the basic ones in freshman and sophomore courses.
Interlude: What kind of program is Sage? What language does it use?

Sage also contains the best of opensource mathematical programs. As an example, the program R is actually a component of Sage, which we can use directly from the notebook.
Min. 1st Qu. Median Mean 3rd Qu. Max. 2.70500 0.83980 0.05069 0.05685 0.68200 2.56700 Min. 1st Qu. Median Mean 3rd Qu. Max. 2.70500 0.83980 0.05069 0.05685 0.68200 2.56700 
There is one last thing I haven't shown too much of, namely plotting. But we should certainly return to that as our final set of examples before I set us all loose.

You'll notice the "figsize=5"; that's just there because the projector I use probably won't project this worksheet at full size so we make graphics a bit smaller.



There are MANY MANY resources for Sage online. A few:
Sage is also so much more than this. As one example, for those familiar with LaTeX, you can combine the power of Sage and LaTeX in SageTeX! I use this to prepare many of my lecture notes and handouts for students.

Remember, for onceoff computations you have some nice options with the Sage cell servers; for more indepth ones, use the notebook server or the SageMath Cloud. Let's check that out for a little bit.
Do you have any questions about other things you might want to try?
Final advertisement:
This worksheet is available at http://sage.math.gordon.edu/home/pub/86
