ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 28 Dec 2017 11:59:29 -0600Cell label resethttps://ask.sagemath.org/question/40336/cell-label-reset/What is the proper way to reset the cell number in a notebook cell?
When I evaluate all the cells of a notebook I want to always start with the number In[1] as the first cell label of the notebook in order to have a predictable number of all the subsequent cells, something like kill(labels) in Maxima.
Thu, 28 Dec 2017 04:59:31 -0600https://ask.sagemath.org/question/40336/cell-label-reset/Answer by vdelecroix for <p>What is the proper way to reset the cell number in a notebook cell?
When I evaluate all the cells of a notebook I want to always start with the number In[1] as the first cell label of the notebook in order to have a predictable number of all the subsequent cells, something like kill(labels) in Maxima.</p>
https://ask.sagemath.org/question/40336/cell-label-reset/?answer=40338#post-id-40338In Jupyter, the number on the left are **not** the number of the cells but the order in the execution. [IPython](https://ipython.org/) has the very same behavior
$ sage -ipython
Python 2.7.14 (default, Dec 13 2017, 23:18:38)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: 1+1
Out[1]: 2
In [2]: 3+5
Out[2]: 8
In [3]:
But in a console as above, you are not allowed to edit the input lines as you would do with cells in a notebook.
The proper way to reinitialize the execution of the kernel (and hence starting again from 1) is to do **Kernel -> Restart**.Thu, 28 Dec 2017 09:15:16 -0600https://ask.sagemath.org/question/40336/cell-label-reset/?answer=40338#post-id-40338Comment by vdelecroix for <p>In Jupyter, the number on the left are <strong>not</strong> the number of the cells but the order in the execution. <a href="https://ipython.org/">IPython</a> has the very same behavior</p>
<pre><code>$ sage -ipython
Python 2.7.14 (default, Dec 13 2017, 23:18:38)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: 1+1
Out[1]: 2
In [2]: 3+5
Out[2]: 8
In [3]:
</code></pre>
<p>But in a console as above, you are not allowed to edit the input lines as you would do with cells in a notebook.</p>
<p>The proper way to reinitialize the execution of the kernel (and hence starting again from 1) is to do <strong>Kernel -> Restart</strong>.</p>
https://ask.sagemath.org/question/40336/cell-label-reset/?comment=40343#post-id-40343First of all, I assume that you are using the Jupyter notebook since the legacy Sage notebook does not have any numbering for its cell (at least that are visible). As I wrote at the end of my answer you should use **Kernel -> Restart**.Thu, 28 Dec 2017 11:59:29 -0600https://ask.sagemath.org/question/40336/cell-label-reset/?comment=40343#post-id-40343Comment by danielvolinski for <p>In Jupyter, the number on the left are <strong>not</strong> the number of the cells but the order in the execution. <a href="https://ipython.org/">IPython</a> has the very same behavior</p>
<pre><code>$ sage -ipython
Python 2.7.14 (default, Dec 13 2017, 23:18:38)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: 1+1
Out[1]: 2
In [2]: 3+5
Out[2]: 8
In [3]:
</code></pre>
<p>But in a console as above, you are not allowed to edit the input lines as you would do with cells in a notebook.</p>
<p>The proper way to reinitialize the execution of the kernel (and hence starting again from 1) is to do <strong>Kernel -> Restart</strong>.</p>
https://ask.sagemath.org/question/40336/cell-label-reset/?comment=40342#post-id-40342What I want is a command in a Sage Notebook cell that will make the next cell executed to be In[1]Thu, 28 Dec 2017 11:19:20 -0600https://ask.sagemath.org/question/40336/cell-label-reset/?comment=40342#post-id-40342