Jupyter Markup



Jupyter Notebook is a great addition to your toolset when starting off with Python and especially Machine Learning. At the risk of oversimplifying the functionality, it allows you to execute python. Here’s how to debug your code when using a Jupyter/iPython notebook. Here’s an example using a simple function (based on this lucid explanation). Def testdebug (y): x = 10 # One.

Origin in IPython

Cell

Jupyter (http://jupyter.org) is an amazing productivity environment that's under active development and rapidly evolving into a powerful tool for academic and other applications. Jupyter emerged from IPython, an earlier notebook environment that only supported Python activities, but the new scheme, apart from being more advanced, supports many more languages.

Notebooks and Kernels

The basic premise of Jupyter is that a single, well-designed work environment can host any number of language 'kernels' or sources of computation and data, for inclusion in content created in the Jupyter notebook interface.

MarkupJupyter markup latex

Available Languages

Languages now available include Python (of course), SageMath, Bash, Octave, Julia, Haskell, Ruby, JavaScript, Scala, Erlang, and many more. When installed as Jupyter kernels each language becomes accessible in the same way, using the same notebook interface.

Python/Sympy Example

Jupyter runs a local HTTP server and its notebook environment appears in your browser, where you choose the kernels you want to interact with. Here's an example Python/SymPy notebook session:

NOTE: Each of this page's Jupyter examples can be copied directly from the code cells and pasted into your Jupyter environment for further exploration.

Calculus Example

Here's a more advanced example that solves a second-order differential equation (an example of the so-called 'harmonic oscillator' equation):

NewJupyter begin{equation} y(t) + frac{d^2}{dt^2}y(t) = 0 end{equation}

Here's the solution and a plot of the result:

Rapid Development

Jupyter Markdown Table

To me personally, Jupyter's real value is shown by the speed with which tasks move forward. I can create notebooks for languages that once required a slow manual cycle of edit, save, execute, repeat. Now I get very fast interactive results in environments that once were notorious time-wasters — like Bash:

It's not obvious in the above example, but I can change a few characters and run the code again with a keystroke.

SageMath/Graph Theory

SageMath is a more powerful, but much larger, kernel that can be made available to Jupyter. SageMath is an integrated collection of many mathematical libraries of interest to academics and applied mathematicians, and has a very good symbolic mathematics capability. Here's a SageMath example that shows off an esoteric graphing feature (with an uncommon meaning for the word 'graph')*:

Notice how each character — including the space — in the test phrase 'Natural Selection' appears in the result graph, mapped in a way to avoid multiple appearances of a character used more than once.

Parallel Kernels

Jupyter Markdown Image

It's not apparent from these examples, but one can open multiple notebooks, each running a different Jupyter 'kernel,' and move between them to take advantage of each one's strengths. In fact, in a project named JupyterLab, this multiple-process idea is being actively pursued. It seems likely that, when fully developed, JupyterLab will replace Jupyter.

Jupyter Markup New Line

For those who find Jupyter intriguing and want a closer look, we can move on to the task of installing Jupyter.