getting-started-sagenotebook/script.rst
author anand
Mon, 15 Nov 2010 15:51:46 +0530
changeset 515 0eaf233cb64f
parent 460 5d032e253580
child 516 fcb9936eb009
permissions -rw-r--r--
checklist ok
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
515
0eaf233cb64f checklist ok
anand
parents: 460
diff changeset
    25
   Internal Reviewer   : Punch
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
   External Reviewer   :
515
0eaf233cb64f checklist ok
anand
parents: 460
diff changeset
    27
   Language Reviewer   : Bhanukiran
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
   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
    29
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
Script
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
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    34
{{{ Show the slide containing the title }}}
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    35
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
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
    37
Sage and Sage notebook.
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
{{{ Show the slide containing the outline }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
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
    42
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
    43
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
    44
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
    45
the offline help available.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
{{{ Show the slide on what is Sage }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
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
    50
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
    51
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
    52
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
    53
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
    54
now
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
{{{ Shift to terminal }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
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
    59
not please visit the page
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
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
    61
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
    62
460
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    63
5d032e253580 Changes to getting started with Sage notebook.
Puneeth Chaganti <punchagan@fossee.in>
parents: 314
diff changeset
    64
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
    65
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
  sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
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
    69
like this
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
{{{ Show what is displayed on the terminal }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
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
    74
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
    75
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
    76
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
    77
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
    78
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
    79
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
    80
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
    81
a browser, a modern browser 
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
{{{ Intentional *cough* *cough* }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
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
    86
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
    87
for research and teaching.
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
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
    90
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
    91
notebook server just type::
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
  notebook()
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
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
    96
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
    97
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
    98
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
    99
with the notebook opened.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
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
   102
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
   103
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
   104
the notebook command on the sage prompt.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
{{{ The notebook() command gives an instruction telling 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
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
   108
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
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
   110
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
{{{ Show the browser with Sage notebook }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
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
   114
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
   115
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
   116
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
   117
password and to create new accounts.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
{{{ 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
   120
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
   121
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
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
   123
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
   124
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
   125
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
   126
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
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
   128
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
   129
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   130
{{{ 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
   131
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
   132
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   133
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
   134
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
   135
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
   136
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
   137
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
   138
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
   139
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
   140
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
   141
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
   142
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
   143
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   144
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
   145
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
{{{ Click on the link }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   147
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   148
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
   149
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
   150
empty.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   151
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   152
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
   153
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
   154
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
   155
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
   156
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   157
  2 + 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   158
  57.1 ^ 100
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   160
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
   161
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
   162
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
   163
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
   164
we want to be displayed.
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
{{{ Demonstrate creating a new cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   167
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   168
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
   169
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
   170
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
   171
can create a new cell. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   172
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   173
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
   174
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
   175
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
   176
the cell
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
{{{ 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
   179
}}}::
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
  matrix([[1,2], [3,4]])^(-1)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   182
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   183
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
   184
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
   185
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
   186
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   187
{{{ Move between two cells created }}}
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
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
   190
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   191
{{{ Clear and demonstrate deleting the cell }}}::
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
  Makes no sense
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   194
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   195
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
   196
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
   197
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
   198
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
{{{ Create a HTML editable cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   201
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   202
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
   203
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
   204
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   205
  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
   206
  text.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
  It also contains bulleted list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   208
  * Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
  * Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
  It also contains enumerate list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
  1. Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
  2. Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   214
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
   215
syntax::
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
  $\int_0^\infty e^{-x} \, dx$
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   218
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   219
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
   220
LaTeX.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   221
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   222
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
   223
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
   224
command::
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
  sin?
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   227
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   228
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
   229
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
   230
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
   231
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   232
  matrix??
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   233
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   234
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
   235
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
   236
key::
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
  sudo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   239
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   240
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
   241
characters and hit 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
  plo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   244
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   245
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
   246
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
   247
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
   248
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   249
  s = 'Hello'
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   250
  s.rep<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   251
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   252
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
   253
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
   254
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
   255
the cell did not successfully execute::
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
  a, b = 10
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
{{{ Show the three states }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   260
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   261
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
   262
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
   263
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
   264
cycles.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   265
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   266
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
   267
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
   268
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
   269
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
   270
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
   271
Python code we put::
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
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   274
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   275
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
   276
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
   277
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
   278
default Sage mode is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   279
{{{ Read the output }}}::
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   280
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   281
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   282
  type(a)
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
  Output: <type 'sage.rings.integer.Integer'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   285
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   286
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
   287
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
   288
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   289
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   290
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   291
  type(a)
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
  Output: <type 'int'>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   294
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   295
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
   296
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
   297
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   298
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
   299
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
   300
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
   301
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
   302
learnt. In this session we learnt
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   303
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   304
  * What is Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   305
  * How to start Sage shell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   306
  * What is Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   307
  * How to start the Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   308
  * 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
   309
  * How to create new worksheets
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   310
  * The menus available on the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   311
  * About cells in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   312
  * 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
   313
    and navigate around the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   314
  * To make annotations in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   315
  * Tab completions
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   316
  * 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
   317
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   318
{{{ Show the "sponsored by FOSSEE" slide }}}
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
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
   321
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   322
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
   323
Thank you!