/notebooks

:notebook: A growing collection of Jupyter Notebooks written in Python, OCaml and Julia for science examples, algorithms, visualizations etc

Primary LanguageJupyter NotebookMIT LicenseMIT

This repository hosts some Jupyter Notebooks, covering various subjects. Go to nbviewer to read them.

You can also launch an interactive environment to play with the code by yourself, using one of these platforms: MyBinder v2 Google Colab: Launch

At the beginning, this repository was only here to host some small experiments, for me to learn how to use the wonderful Jupyter tools correctly (baby notebooks 🍼)...

🐚 Bash

🐍 Python

I am a passionate user of the Python programming language.

Science

Teaching

Numerical simulations for dice games (:fr: in French)

🎨 Art

art/identicons.png

art/citation_du_roi_Loth_aleatoires.png

I will try to write more artistic notebooks, showcasing nice pieces of code 🎨!

Experiments with Python

  • This small notebook (on GitHub?) is a fun experiment, where I tried to use James Powell (@dutc) rwatch module to write a Python context manager to add a Gaussian white noise to every numbers inside the context... Something like: with noise(): x = 10 will produce x = 10.325 for instance... It fails, but I almost got it, and it works (without breaking the interpreter) for complex numbers. That's already intersting!

  • This notebook (on GitHub?) is a small experiment, written quickly, about floating-point error propagation when using a non-naive polynomial multiplication with evaluation-and-interpolation. Sadly, this approach fails!

  • A tiny presentation on how to do time/memory profiling (on GitHub?) from inside the Jupyter notebook interface, with various approaches.

Experiments with Jupyter

With Julia

🐫 OCaml

And more will come... soon! 🚅

made-with-jupyter made-with-python made-with-ocaml made-with-julia


1. How to read these documents?

1.a. View the notebooks statically 📝

1.b. Play with the notebooks dynamically 💥

MyBinder

Anyone can use the mybinder.org website (by clicking on the icon above) to run the notebook in her/his web-browser. You can then play with it as long as you like, for instance by modifying the values or experimenting with the code.

MyBinder v2

Note: Only the Python kernel is supported on the MyBinder interface!


2. Requirements to run the notebooks locally?

All the requirements can be installed with pip and by running a few python -m ... commands.

Note: if you use Python 3 instead of Python 2, you might have to replace pip and python by pip3 and python3 in the next commands (if both pip and pip3 are installed).

sudo pip install jupyter ipython

It will also install all the dependencies, afterward you should have a jupyter-notebook command (or a jupyter command, to be ran as jupyter notebook) available in your PATH:

$ whereis jupyter-notebook
jupyter-notebook: /usr/local/bin/jupyter-notebook
$ jupyter-notebook --version  # version >= 4 is recommended
4.2.1

2.b. Other kernels (optional):

They are only needed to run the notebooks written for Bash or Octave (or OCaml):

$ bash --version | head -n1
GNU bash, version 4.3.42(1)-release (x86_64-pc-linux-gnu)
  • And then install the kernel bash_kernel with these two commands:
sudo pip install bash_kernel
python -m bash_kernel.install
  • You have to have octave installed (installable with the package manager on major Linux distributions (apt-get, pacman, yum etc), installable with brew or macports on Mac OS, available on Windows through cygwin or natively):
$ octave --version | head -n1
GNU Octave, version 4.0.0
  • Your version of Octave should be installed with gnuplot support (it is usually the case):
$ gnuplot --version | head -n1
gnuplot 5.0 patchlevel 1
  • And then install the kernel bash_kernel with these two commands:
sudo pip install octave_kernel
python -m octave_kernel.install

It is quite easy to install, with opam:

opam install jupyter

I started by using this OCaml kernel called IOCaml. The instructions were not so simple, cf. the tutorial by @andrewray on iocaml's wiki. It was prone to some bugs, and I had to manually implement a script to be able to convert the notebooks to PDF with jupyter-nbconvert --to pdf. Note that I also had to write a custom Exporter for jupyter-nbconvert in order to convert the notebooks to OCaml scripts (.ml).


💁 More information?

📜 License ? GitHub license

All the notebooks in this repository are published under the terms of the MIT License (file LICENSE.txt). © Lilian Besson, 2016-18.

Maintenance Ask Me Anything ! Analytics

ForTheBadge uses-badges ForTheBadge uses-git

ForTheBadge built-with-science