getting-started-sagenotebook/script.rst
author Amit Sethi
Tue, 09 Nov 2010 12:31:05 +0530
changeset 414 f76622c8cbd9
parent 314 11869b16d86b
child 460 5d032e253580
permissions -rw-r--r--
Review of addition ipython
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
.. Objectives
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
.. ----------
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
.. Clearly state the objectives of the LO (along with RBT level)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
.. By the end of this tutorial, you should -- 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
..   #. Know what Sage and Sage notebook are.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
..   #. Be able to start a Sage shell or notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
..   #. Be able to start using the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
..   #. Be able to create new worksheets 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
..   #. Know about the menu options available 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
..   #. Know about the cells in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
..   #. Be able to evaluate cells, create and delete cells, navigate them.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
..   #. Be able to make annotations in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
..   #. Be able to use tab completion. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
..   #. Be able to use code from other languages in the cells. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
.. Prerequisites
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
.. -------------
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
.. None. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
     
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
.. Author              : Madhu
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
   Internal Reviewer   : 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
   External Reviewer   :
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
   Checklist OK?       : <put date stamp here, if OK> [2010-10-05]
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
Script
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
------
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
Hello friends. Welcome to this spoken tutorial on Getting started with
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
sage and sage notebook.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
{{{ Show the slide containing the title }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
{{{ Show the slide containing the outline }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
In this tutorial, we will learn what Sage is, what is Sage notebook,
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
how to start and use the sage notebook. In the notebook we will be
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
specifically learning how to execute our code, how to write
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
annotations and other content, typesetting the content and how to use
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
the offline help available.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
{{{ Show the slide on what is Sage }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
To start with, What is Sage? Sage is a free, open-source mathematical
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
software. Sage can do a lot of math stuff for you including but not
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
limited to algebra, calculus, geometry, cryptography, graph theory
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
among other things. It can also be used as aid in teaching and
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
research in any of the areas that Sage supports. So let us start Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
now
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
{{{ Shift to terminal }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
We are assuming that you have Sage installed on your computer now. If
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
not please visit the page
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
http://sagemath.org/doc/tutorial/introduction.html#installation for
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
the tutorial on how to install Sage. Let us move on now.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
On the terminal type::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
  sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
This should start a new Sage shell with the prompt sage: which looks
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
like this
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
{{{ Show what is displayed on the terminal }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
So now we can type all the commands that Sage supports here. But Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
comes bundled with a much much much more elegant tool called Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
Notebook? What is Sage Notebook? Sage Notebook provides a web based
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
user interface to use Sage. So once we have a Sage notebook server up
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
and running all we want is a browser to access the Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    76
functionality. For example there is an official instance of Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
Notebook server running at http://sagenb.org You can visit that page,
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
create an account there and start using Sage! So all you need is just
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
a browser, a modern browser 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
{{{ Intentional *cough* *cough* }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
to use Sage and nothing else! The Sage notebook also provides a
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
convenient way of sharing and publishing our work which is very handy
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
when we use Sage for research or for teaching.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
However we can also run our own instances of Sage notebook servers on
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
all the computers we have a local installation of Sage. To start the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
notebook server just type::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
  notebook()
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
on the Sage prompt. This will start the Sage Notebook server. If we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
are starting the notebook server for the first time, we are prompted
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
to enter the password for the admin. Type the password and make a note
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
of it. After this Sage automatically starts a browser page for you
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
with the notebook opened.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
If it doesn't automatically start a browser page check if the Notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
server started and there were no problems. If so open your browser and
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
in the address bar type the URL shown in the instructions upon running
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
the notebook command on the sage prompt.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
{{{ The notebook() command gives an instruction telling 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
Open your web browser to http://localhost:8000. Point towards it }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
In our case it is http://localhost:{{{ Tell whatever is shown }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
{{{ Show the browser with Sage notebook }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
If you are not logged in yet, it shows the Notebook home page and
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
textboxes to type the username and the password. You can use the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
username 'admin' and the password you gave while starting the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
server for the first time. There are also links to recover forgotten
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
password and to create new accounts.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   116
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
{{{ If you are logged in tell that you are logged in, log out and show
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
what is said above for the login page }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
Once we are logged in with the admin account we can see the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
admin page. A notebook can contain a collection of Sage Notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
worksheets. Worksheets are basically the working area. This is where
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   123
we enter all the Sage commands on the notebook.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   125
The admin page lists all the worksheets created. On the topmost part
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
of this page we have the links to various pages. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   128
{{{ Whenever you talk on an individual link point your mouse towards
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
the link. For each of the link go to the page and explain as below }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   130
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   131
The home link takes us to the admin home page. The published link
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   132
takes us to the page which lists all the published worksheets. The log
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   133
link has the complete log of all the actions we did on the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   134
notebook. We have the settings link where can configure our notebook,
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   135
the notebook server, we can create and mangage accounts. We have a
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   136
link to help upon clicking opens a new window with the complete help
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   137
of Sage. The entire documentation of Sage is supplied with Sage for
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   138
offline reference and this help link is the way to get into it. Then
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   139
we can report bugs about Sage by clicking on Report a Problem link and
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   140
there is a link to sign out of the notebook.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   141
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   142
We can create a new worksheet by clicking New Worksheet link
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   143
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   144
{{{ Click on the link }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   145
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
Sage prompts you for a name for the worksheet. Let us name the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   147
worksheet as nbtutorial. Now we have our first worksheet which is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   148
empty.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   149
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   150
A worksheet will contain a collection of cells. Every Sage command
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   151
must be entered in this cell. Cell is equivalent to the prompt on
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   152
console. When we create a new worksheet, to start with we will have
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   153
one empty cell. Let us try out some math here::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   154
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   155
  2 + 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   156
  57.1 ^ 100
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   157
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   158
The cap operator is used for exponentiation. If you observed carefully
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
we typed two commands but the output of only last command was
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   160
displayed. By default each cell displays the result of only the last
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   161
operation. We have to use print statement to display all the results
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   162
we want to be displayed.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   163
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   164
{{{ Demonstrate creating a new cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   165
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   166
Now to perform more operations we want more cells. So how do we create
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   167
a new cell? It is very simple. As we hover our mouse above or below
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   168
the existing cells we see a blue line, by clicking on this new line we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   169
can create a new cell. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   170
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   171
We have a cell, we have typed some commands in it, but how do we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   172
evaluate that cell? Pressing Shift along with Enter evaluates the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   173
cell. Alternatively we can also click on the evaluate link to evaluate
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   174
the cell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   175
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   176
{{{ Evaluate the cell and demonstrate for both methods separately
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   177
}}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   178
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   179
  matrix([[1,2], [3,4]])^(-1)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   180
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   181
After we create many cells, we may want to move between the cells. To
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   182
move between the cells use Up and Down arrow keys. Also clicking on
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   183
the cell will let you edit that particular cell.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   184
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   185
{{{ Move between two cells created }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   186
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   187
To delete a cell, clear the contents of the cell and hit backspace
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   188
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   189
{{{ Clear and demonstrate deleting the cell }}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   190
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   191
  Makes no sense
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   192
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   193
If you want to add annotations in the worksheet itself on the blue
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   194
line that appears on hovering the mouse around the cell, Hold Shift
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   195
and click on the line. This creates a What You See Is What You Get
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   196
cell.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   197
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   198
{{{ Create a HTML editable cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   199
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   200
We can make our text here rich text. We can make it bold, Italics, we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   201
can create bulleted and enumerated lists in this area::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   202
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   203
  This text contains both the **bold** text and also *italicised*
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   204
  text.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   205
  It also contains bulleted list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   206
  * Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
  * Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   208
  It also contains enumerate list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
  1. Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
  2. Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
In the same cell we can display typeset math using the LaTeX like
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
syntax::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   214
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   215
  $\int_0^\infty e^{-x} \, dx$
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   216
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   217
We enclose the math to be typeset within $ and $ or $$ and $$ as in
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   218
LaTeX.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   219
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   220
We can also obtain help for a particular Sage command or function
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   221
within the worksheet itself by using a question mark following the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   222
command::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   223
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   224
  sin?
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   225
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   226
Evaluating this cell gives me the entire help for the sin function
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   227
inline on the worksheet itself. Similarly we can also look at the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   228
source code of each command or function using double question mark::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   229
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   230
  matrix??
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   231
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   232
Sage notebook also provides the feature for autocompletion. To
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   233
autocomplete a command type first few unique characters and hit tab
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   234
key::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   235
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   236
  sudo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   237
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   238
To see all the commands starting with a specific name type those
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   239
characters and hit tab::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   240
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   241
  plo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   242
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   243
To list all the methods that are available for a certain variable or
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   244
a datatype we can use the variable name followed by the dot to access
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   245
the methods available on it and then hit tab::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   246
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   247
  s = 'Hello'
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   248
  s.rep<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   249
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   250
The output produced by each cell can be one of the three states. It
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   251
can be either the full output, or truncated output or hidden output.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   252
The output area will display the error if the Sage code we wrote in
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   253
the cell did not successfully execute::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   254
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   255
  a, b = 10
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   256
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   257
{{{ Show the three states }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   258
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   259
The default output we obtained now is a truncated output. Clicking at
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   260
the left of the output area when the mouse pointer turns to hand gives
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   261
us the full output, clicking again makes the output hidden and it
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   262
cycles.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   263
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   264
Lastly, Sage supports a variety of languages and each cell on the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   265
worksheet can contain code written in a specific language. It is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   266
possible to instruct Sage to interpret the code in the language we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   267
have written. This can be done by putting percentage sign(%) followed
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   268
by the name of the language. For example, to interpret the cell as
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   269
Python code we put::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   270
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   271
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   272
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   273
as the first line in the cell. Similarly we have: %sh for shell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   274
scripting, %fortran for Fortran, %gap for GAP and so on. Let us see
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   275
how this works. Say I have an integer. The type of the integer in
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   276
default Sage mode is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   277
{{{ Read the output }}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   278
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   279
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   280
  type(a)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   281
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   282
  Output: <type 'sage.rings.integer.Integer'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   283
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   284
We see that Integers are Sage Integers. Now let us put %python as the
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   285
first line of the cell and execute the same code snippet::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   286
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   287
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   288
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   289
  type(a)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   290
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   291
  Output: <type 'int'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   292
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   293
Now we see that the integer is a Python integer. Why? Because now we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   294
instructed Sage to interpret that cell as Python code.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   295
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   296
This brings us to the end of the tutorial on using Sage. We learnt
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   297
quite a lot about using the Notebook User Interface of Sage. We are
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   298
now confident that we can comfortably use the notebook to learn more
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   299
about Sage in the following tutorials. Let us summarize what we
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   300
learnt. In this session we learnt
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   301
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   302
  * What is Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   303
  * How to start Sage shell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   304
  * What is Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   305
  * How to start the Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   306
  * How to create accounts and start using the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   307
  * How to create new worksheets
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   308
  * The menus available on the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   309
  * About cells in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   310
  * Methods to evaluate the cell, create new cells, delete the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   311
    and navigate around the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   312
  * To make annotations in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   313
  * Tab completions
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   314
  * And embedding code of other scripting languages in the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   315
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   316
{{{ Show the "sponsored by FOSSEE" slide }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   317
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   318
This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   319
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   320
Hope you have enjoyed and found it useful.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   321
Thank you!
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   322
 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   323