getting-started-sagenotebook/script.rst
author bhanu
Mon, 15 Nov 2010 16:07:00 +0530
changeset 516 fcb9936eb009
parent 515 0eaf233cb64f
child 517 71697b10f4ae
permissions -rw-r--r--
Language check done for `getting started with sagenotebook`
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
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    50
software. Sage can do a lot of math stuff for you including, but not
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    51
limited to, algebra, calculus, geometry, cryptography, graph theory
314
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
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    74
comes bundled with a much more elegant tool called Sage
314
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
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    77
and running, all we want is a browser to access the Sage
314
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
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    85
#[[Bhanu: what? Are you serious?]]
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
    86
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
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
    88
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
    89
for research and teaching.
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
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
    92
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
    93
notebook server just type::
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
  notebook()
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
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
    98
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
    99
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
   100
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
   101
with the notebook opened.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
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
   104
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
   105
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
   106
the notebook command on the sage prompt.
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
{{{ The notebook() command gives an instruction telling 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
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
   110
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
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
   112
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
{{{ Show the browser with Sage notebook }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
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
   116
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
   117
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
   118
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
   119
password and to create new accounts.
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
{{{ 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
   122
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
   123
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
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
   125
admin page. A notebook can contain a collection of Sage Notebook
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
   126
worksheets. Worksheet is basically a working area. This is where
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
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
   128
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
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
   130
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
   131
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   132
{{{ 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
   133
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
   134
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   135
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
   136
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
   137
link has the complete log of all the actions we did on the
516
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
   138
notebook. We have the settings link where we can configure our notebook,
fcb9936eb009 Language check done for `getting started with sagenotebook`
bhanu
parents: 515
diff changeset
   139
the notebook server, create and  mangage accounts. We have a
314
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   140
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
   141
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
   142
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
   143
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
   144
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
   145
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
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
   147
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   148
{{{ Click on the link }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   149
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   150
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
   151
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
   152
empty.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   153
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   154
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
   155
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
   156
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
   157
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
   158
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
  2 + 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   160
  57.1 ^ 100
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   161
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   162
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
   163
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
   164
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
   165
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
   166
we want to be displayed.
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
{{{ Demonstrate creating a new cell }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   169
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   170
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
   171
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
   172
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
   173
can create a new cell. 
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   174
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   175
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
   176
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
   177
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
   178
the cell
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
{{{ 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
   181
}}}::
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
  matrix([[1,2], [3,4]])^(-1)
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   184
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   185
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
   186
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
   187
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
   188
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   189
{{{ Move between two cells created }}}
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
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
   192
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   193
{{{ Clear and demonstrate deleting the cell }}}::
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
  Makes no sense
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   196
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   197
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
   198
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
   199
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
   200
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
{{{ Create a HTML editable cell }}}
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
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
   205
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
   206
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
  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
   208
  text.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
  It also contains bulleted list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
  * Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
  * Item 2
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
  It also contains enumerate list:
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
  1. Item 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   214
  2. Item 2
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
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
   217
syntax::
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
  $\int_0^\infty e^{-x} \, dx$
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 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
   222
LaTeX.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   223
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   224
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
   225
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
   226
command::
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
  sin?
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   229
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   230
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
   231
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
   232
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
   233
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   234
  matrix??
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   235
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   236
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
   237
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
   238
key::
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
  sudo<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
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
   243
characters and hit 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
  plo<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   246
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   247
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
   248
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
   249
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
   250
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   251
  s = 'Hello'
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   252
  s.rep<tab>
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   253
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   254
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
   255
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
   256
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
   257
the cell did not successfully execute::
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
  a, b = 10
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
{{{ Show the three states }}}
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   262
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   263
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
   264
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
   265
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
   266
cycles.
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   267
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   268
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
   269
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
   270
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
   271
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
   272
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
   273
Python code we put::
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
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   276
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   277
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
   278
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
   279
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
   280
default Sage mode is
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   281
{{{ Read the output }}}::
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
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   284
  type(a)
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
  Output: <type 'sage.rings.integer.Integer'>
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
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
   289
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
   290
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   291
  %python
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   292
  a = 1
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   293
  type(a)
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
  Output: <type 'int'>
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
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
   298
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
   299
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   300
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
   301
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
   302
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
   303
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
   304
learnt. In this session we learnt
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   305
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   306
  * What is Sage
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   307
  * How to start Sage shell
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   308
  * What is Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   309
  * How to start the Sage notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   310
  * 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
   311
  * How to create new worksheets
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   312
  * The menus available on the notebook
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   313
  * About cells in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   314
  * 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
   315
    and navigate around the cells
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   316
  * To make annotations in the worksheet
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   317
  * Tab completions
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   318
  * 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
   319
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   320
{{{ Show the "sponsored by FOSSEE" slide }}}
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
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
   323
11869b16d86b Getting started with sagenotebook LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   324
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
   325
Thank you!