getting-started-sagenotebook/script.rst
author Puneeth Chaganti <punchagan@fossee.in>
Thu, 11 Nov 2010 03:00:19 +0530
changeset 460 5d032e253580
parent 314 11869b16d86b
child 515 0eaf233cb64f
permissions -rw-r--r--
Changes to getting started with Sage notebook.
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. 
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    17
..   #. Be able to use code from other languages in the cells.            
314
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
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    33
{{{ Show the slide containing the title }}}
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    34
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
Hello friends. Welcome to this spoken tutorial on Getting started with
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    36
Sage and Sage notebook.
314
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
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    60
the tutorial on how to install Sage. 
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    62
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    63
Let us now learn how to start Sage. On the terminal type::
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
  sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
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
    68
like this
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
{{{ Show what is displayed on the terminal }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
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
    73
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
    74
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
    75
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
    76
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
    77
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
    78
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
    79
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
    80
a browser, a modern browser 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
{{{ Intentional *cough* *cough* }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
to use Sage and nothing else! The Sage notebook also provides a
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    85
convenient way of sharing and publishing our work, which is very handy
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    86
for research and teaching.
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
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
    89
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
    90
notebook server just type::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
  notebook()
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
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
    95
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
    96
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
    97
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
    98
with the notebook opened.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
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
   101
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
   102
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
   103
the notebook command on the sage prompt.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
{{{ The notebook() command gives an instruction telling 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
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
   107
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
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
   109
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
{{{ Show the browser with Sage notebook }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
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
   113
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
   114
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
   115
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
   116
password and to create new accounts.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
{{{ 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
   119
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
   120
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
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
   122
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
   123
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
   124
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
   125
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
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
   127
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
   128
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
{{{ 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
   130
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
   131
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   132
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
   133
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
   134
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
   135
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
   136
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
   137
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
   138
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
   139
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
   140
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
   141
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
   142
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   143
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
   144
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   145
{{{ Click on the link }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   147
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
   148
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
   149
empty.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   150
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   151
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
   152
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
   153
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
   154
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
   155
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   156
  2 + 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   157
  57.1 ^ 100
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   158
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
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
   160
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
   161
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
   162
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
   163
we want to be displayed.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   164
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   165
{{{ Demonstrate creating a new cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   166
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   167
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
   168
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
   169
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
   170
can create a new cell. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   171
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   172
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
   173
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
   174
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
   175
the cell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   176
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   177
{{{ 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
   178
}}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   179
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   180
  matrix([[1,2], [3,4]])^(-1)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   181
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   182
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
   183
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
   184
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
   185
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   186
{{{ Move between two cells created }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   187
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   188
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
   189
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   190
{{{ Clear and demonstrate deleting the cell }}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   191
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   192
  Makes no sense
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   193
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   194
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
   195
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
   196
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
   197
cell.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   198
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   199
{{{ Create a HTML editable cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   200
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   201
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
   202
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
   203
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   204
  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
   205
  text.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   206
  It also contains bulleted list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
  * Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   208
  * Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
  It also contains enumerate list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
  1. Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
  2. Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
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
   214
syntax::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   215
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   216
  $\int_0^\infty e^{-x} \, dx$
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   217
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   218
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
   219
LaTeX.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   220
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   221
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
   222
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
   223
command::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   224
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   225
  sin?
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   226
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   227
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
   228
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
   229
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
   230
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   231
  matrix??
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   232
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   233
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
   234
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
   235
key::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   236
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   237
  sudo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   238
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   239
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
   240
characters and hit tab::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   241
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   242
  plo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   243
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   244
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
   245
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
   246
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
   247
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   248
  s = 'Hello'
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   249
  s.rep<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   250
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   251
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
   252
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
   253
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
   254
the cell did not successfully execute::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   255
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   256
  a, b = 10
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   257
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   258
{{{ Show the three states }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   259
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   260
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
   261
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
   262
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
   263
cycles.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   264
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   265
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
   266
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
   267
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
   268
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
   269
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
   270
Python code we put::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   271
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   272
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   273
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   274
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
   275
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
   276
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
   277
default Sage mode is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   278
{{{ Read the output }}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   279
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   280
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   281
  type(a)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   282
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   283
  Output: <type 'sage.rings.integer.Integer'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   284
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   285
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
   286
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
   287
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   288
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   289
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   290
  type(a)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   291
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   292
  Output: <type 'int'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   293
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   294
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
   295
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
   296
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   297
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
   298
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
   299
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
   300
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
   301
learnt. In this session we learnt
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   302
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   303
  * What is Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   304
  * How to start Sage shell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   305
  * What is Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   306
  * How to start the Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   307
  * 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
   308
  * How to create new worksheets
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   309
  * The menus available on the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   310
  * About cells in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   311
  * 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
   312
    and navigate around the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   313
  * To make annotations in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   314
  * Tab completions
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   315
  * 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
   316
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   317
{{{ Show the "sponsored by FOSSEE" slide }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   318
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   319
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
   320
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   321
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
   322
Thank you!