Quellcode-Bibliothek jupyter-functionality.ipynb
Sprache: unbekannt
|
|
Untersuchungsergebnis.ipynb Download desUnknown {[0] [0] [0]}zum Wurzelverzeichnis wechseln {
"cells": [
{
"cell_type": "markdown",
"id": "5f0e7082",
"metadata": {},
"source": [
"# Jupyter-Specific Functionality\n",
"While GAP does provide a lot of useful functionality by itself on the command line, it is enhanced greatly by the numerous features that Jupyter notebooks have to offer. This notebook attempts to provide some insight into how Jupyter notebooks can improve the workflow of a user who is already well-versed in GAP."
]
},
{
"cell_type": "markdown",
"id": "ad6e5338",
"metadata": {},
"source": [
"## The Basics\n",
"In Jupyter, code is split into a number of cells. While these cells may look independent from one another, and can be run independently, there is some interconnectedness between them. One major example of this is that variables defined in one cell are accessible from cells that are run **after** the cell containing the variable. The value of the variable will be taken from the **most recent** assignment to that variable:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2f6e5247",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 1,
"metadata": {
"text/plain": ""
},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"5"
]
},
"execution_count": 2,
"metadata": {
"text/plain": ""
},
"output_type": "execute_result"
}
],
"source": [
"a := 3; b := 5;"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f39651b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 3,
"metadata": {
"text/plain": ""
},
"output_type": "execute_result"
}
],
"source": [
"a + b;"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e57cb224",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7"
]
},
"execution_count": 4,
"metadata": {
"text/plain": ""
},
"output_type": "execute_result"
}
],
"source": [
"a := 7;"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0e3350f2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"12"
]
},
"execution_count": 5,
"metadata": {
"text/plain": ""
},
"output_type": "execute_result"
}
],
"source": [
"a + b;"
]
},
{
"cell_type": "markdown",
"id": "07fa1f77",
"metadata": {},
"source": [
"To run a cell, users can either use the toolbar at the top and clicking the play button, or use the handy keyboard shortcut `Shift + Enter`. Using this shortcut will also create a new cell so users can continue their work while the cell runs. Using `Enter` by itself will allow users to add lines to a cell, should they so desire. The `Cell` option in the top menu also provides some other commands to run all cells.\n",
"\n",
"Additionally, cells can also support a multitude of different inputs. One useful example of this is markdown. In order to use markdown syntax within a cell, it must be converted to a markdown cell. This conversion can be done by either using the dropdown menu at the top which allows users to change the type of the cell (it will be `Code` by default). Alternatively, users can press the `Esc` key while in the cell, which allows them to access \"Command Mode\" for the cell. While in this mode, the `M` key can be pressed to convert the cell to a Markdown cell. While in Markdown cells, all the typical markdown syntax is supported.\n",
"\n",
"Furthermore, while in \"Command Mode\", users can use the key sequence `D` `D` to delete cells as they wish. The key `H` can be pressed to look at other useful key shortcuts while in this mode."
]
},
{
"cell_type": "markdown",
"id": "954951c6",
"metadata": {},
"source": [
"## Cell Magic"
]
},
{
"cell_type": "markdown",
"id": "bd6cc8bd",
"metadata": {},
"source": [
"While the main purpose of most users will be GAP-orientated, Jupyter can also render and run some other code fragments. For example, the code magic `%%html` allows Jupyter to render the contents of a code cell as html:"
]
},
{
"cell_type": "markdown",
"id": "47d68c42",
"metadata": {},
"source": [
"## Visualisation\n",
"Another neat feature about Jupyter is the ability to visualise items right after running cells."
]
},
{
"cell_type": "markdown",
"id": "794d1fbe",
"metadata": {},
"source": [
"## Notebook Conversion\n",
"Since Jupyter Notebooks are simply JSON, they can be easily converted to other formats. For example, to convert to HTML one would run:\n",
"\n",
" jupyter nbconvert --to html notebook.ipynb\n",
"\n",
"from their terminal."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "455c2381",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "GAP 4",
"language": "gap",
"name": "gap-4"
},
"language_info": {
"codemirror_mode": "gap",
"file_extension": ".g",
"mimetype": "text/x-gap",
"name": "GAP 4",
"nbconvert_exporter": "",
"pygments_lexer": "gap",
"version": "4.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
[ 0.112Quellennavigators
]
|
2026-03-28
|