(This worksheet is based on William Stein's JPL09__intro_to_sage.sws worksheet.)

Sage Days 20.5 - Tutorial I

Franco Saliola

{{{id=4| /// }}}

Entering, Editing, and Evaluating Input

To evaluate code in the Sage Notebook type the code into an input cell and press shift-enter or click the evaluate link.  Try it now with a simple expression (e.g., 2 + 2).   The first time you evaluate cell takes longer than subsequent times since a process starts.

{{{id=2| /// }}} {{{id=7| /// }}}

Create new input cells by clicking on the blue line that appears between cells when you move your mouse around.  Try it now.

{{{id=10| /// }}} {{{id=12| /// }}}

You can go back and edit any cell by clicking in it (or using the keyboard to move up or down).  Go back and change your 2+2 above to 3 + 3 and re-evaluate it.

{{{id=9| /// }}} {{{id=8| /// }}}

You can also edit this text right here by double clicking on it, which will bring up the TinyMCE Javascript text editor.  You can even put embedded mathematics like this $\sin(x) - y^3$ just like with LaTeX.

{{{id=54| /// }}} {{{id=17| /// }}}

You can also easily make interactive widgets as illustrated below.  Try clicking on the sliders to illustrate multiplication below.   Also, you can try changing the slider ranges to something different by editing the input cell (make sure to also change xmax,ymax).

{{{id=50| @interact def f(n=(1..15), m=(1..15)): print "n * m =", n*m, " =", factor(n*m) P = polygon([(0,0),(0,n),(m,n),(m,0)]) P.show(aspect_ratio=1, gridlines='minor',figsize=[3,3],xmax=14,ymax=14) /// }}} {{{id=52| /// }}}

If you mess everything up, click on Action -> Restart Worksheet at the top of the screen to reset all the variable names and restart everything.  You can also click "Undo" in the upper right to revert the worksheet to a previously saved state.

{{{id=51| /// }}} {{{id=16| /// }}}

Click the Log link at the top of this page to view a log of recent computations!

{{{id=56| /// }}} {{{id=55| /// }}}

How to Get Context-Sensitive Help and Search the Documentation

You find out what functions you can call on an object X by typing X.<tab key>.

{{{id=33| X = 2009 /// }}}

Type X. then press the tab key.

{{{id=28| X. /// }}} {{{id=40| /// }}}

Once you have selected a function, say factor, type X.factor(<tab key> or X.factor?<tab key> to get help and examples of how to use that function.  Try this now with X.factor.

{{{id=39| /// }}} {{{id=38| /// }}}

To get full-text searchable help and a more extensive tutorial, click the Help link in the upper right of this page, then click on Fast Static Versions of the Documentation.

{{{id=53| /// }}} {{{id=42| /// }}}

If you need live help from a person, "operators are standing by".  Just click on Help above, then click on "Help via Internet Chat (IRC)". This brings you to the Sage chat room where you can often get help.

{{{id=44| /// }}} {{{id=36| /// }}}