# [Jupyter Notebooks](http://jupyter.org/) :notebook: by [Naereen @ GitHub](https://naereen.github.io/)

This repository hosts some [Jupyter Notebooks](http://jupyter.org/), covering various subjects.
Go to [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/) to read them.

> At the beginning, this repository was only here to host some small experiments, for me to learn how to use [the wonderful Jupyter tools](http://jupyter.org/) correctly (baby notebooks :baby_bottle:)...

## :shell: Bash
- The first notebooks I wrote are small tutorials for :shell: bash commands (or some of my [command-line scripts](https://bitbucket.org/lbesson/bin/src/master/)), see for example [a tutorial on head and a tail](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Tutorial%20on%20head%20and%20tail%20%28bash%29.ipynb) ([on GitHub?](Tutorial%20on%20head%20and%20tail%20%28bash%29.ipynb)).

## :snake: Python
> I am a passionate user of [the Python programming language](https://www.python.org/).

### Science
- [This notebook written for the Pi Day 2017](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Py_Pi_Day_2017.ipynb) ([on GitHub?](Py_Pi_Day_2017.ipynb)) demonstrates a dozen of easy algorithms to compute from 10 to 100000 digits of the *number pi*.

- [This notebook implements a simple example of the *simulated annealing* algorithm](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Simulated_annealing_in_Python.ipynb) ([on GitHub?](Simulated_annealing_in_Python.ipynb)) to minimize black-box functions :sunglasses:.

- [This notebook shows a hand-written and clear implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Manual_implementation_of_some_hash_functions.ipynb) ([on GitHub?](Manual_implementation_of_some_hash_functions.ipynb)) of several [Hashing functions](https://docs.python.org/3/library/hashlib.html), like MD5, SHA1, and all variants of SHA2 (SHA256, SHA224, SHA512, SHA384).

- [This notebook shows a manual implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Short_study_of_the_Lempel-Ziv_complexity.ipynb) ([on GitHub?](Short_study_of_the_Lempel-Ziv_complexity.ipynb)) of the [Lempel-Ziv complexity](https://en.wikipedia.org/wiki/Lempel-Ziv_complexity) in pure Python, and then as optimized Python code, with Cython or Numba. I also wrote a version in [Julia](http://julialang.org) (in the same notebook), and compare the 4 implementations! I then published my code as a Pypy package, see [here on pypi.org](https://pypi.org/project/Lempel-Ziv_Complexity/).

- [This notebook shows a hand-written and clear implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb) ([on GitHub?](Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb)) of several [Pseudo-Random Number Generators](https://docs.python.org/3/library/random.html), including the famous *Mersenne twister* algorithm, and then uses it to samples from the most famous discrete and continuous distributions, showcasing use of the Inverse-Transform method and Acceptance-Rejection method (cf. Markov Chain Monte-Carlo methods).

- [This notebook implements and compares different Runge-Kutta methods](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_Python.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_Python.ipynb)) for integrating Ordinary Differential Equations in Python. And also [in Julia](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_Julia.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_Julia.ipynb)), and also [in OCaml](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb)). I wanted to compare the three languages for the same algorithms. Well, obviously, Julia is the fastest and simplest for numerical simulations like this.

- :fr: [Ce petit notebook en français](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb) ([sur GitHub ?](Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb)) implémente les algorithmes de vérifications des numéros de cartes bleues, de sécurité sociale et d'IBAN en Python.

- [This notebook implements and explore the Exponential Integral function Ei(x)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Exponential_Integral_Python.ipynb) ([on GitHub?](Exponential_Integral_Python.ipynb)).

- [This notebook shows how to solve the equation exp(- a x²)=x both numerically and formally (with the Lambert W function)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Solving_an_equation_and_the_Lambert_W_function.ipynb) ([on GitHub?](Solving_an_equation_and_the_Lambert_W_function.ipynb)).

- [This notebook implements Kullback-Leibler divergences for some parametric distributions, and KL-UCB indexes, in naive Python and compare with optimized versions using JIT compilation by Numba or C compilation by Cython](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb) ([on GitHub?](Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb)).

- [This short notebook defines and studies the Rényi entropy](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/A_short_study_of_Renyi_entropy.ipynb) ([on GitHub?](A_short_study_of_Renyi_entropy.ipynb)).

### Teaching
- :fr: [Ce notebook en français présente les problèmes de bandits multi-bras stochastiques](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.ipynb) ([on GitHub?](Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.ipynb)) (*multi-armed bandit*, MAB), et les algorithmes dits "de bandits" pour les résoudre (UCB "Upper Confidence Bounds", KL-UCB, Thompson Sampling, Approximated Finite-Horizon Gittins index etc). C'est une bonne introduction aux outils que j'utilise pour [ma thèse](http://perso.crans.org/besson/phd/).

- :fr: I corrected some maths & programming problems from the annals of the [CentraleSupelec national competitive](http://www.concours-centrale-supelec.fr/) exam (in France), in this notebook [Oraux_CentraleSupelec_PSI__Juin_2017.ipynb](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Oraux_CentraleSupelec_PSI__Juin_2017.ipynb) ([on GitHub?](Oraux_CentraleSupelec_PSI__Juin_2017.ipynb)) (for [this kind of oral exam](http://www.concours-centrale-supelec.fr/CentraleSupelec/MultiY/C2015/)). Again in 2018, [Oraux_CentraleSupelec_PSI__Juin_2018.ipynb](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Oraux_CentraleSupelec_PSI__Juin_2018.ipynb) ([on GitHub?](Oraux_CentraleSupelec_PSI__Juin_2018.ipynb)).

### Numerical simulations for dice games (:fr: in French)
- I also wrote some notebooks on numerical simulations of dice games :fr: Voir [ce sous-dossier](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/simus/) (ou [sur GitHub?](simus/)) / :gb: See [this sub-folder](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/simus/) (or [on GitHub?](simus/)).

### :art: Art
- [This notebook shows some "obfuscated" code, producing](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Obfuscated_code_or_piece_of_art.ipynb) ([on GitHub?](Obfuscated_code_or_piece_of_art.ipynb)) :sparkles: [nice figures](art/)... Or maybe they are pieces of code art :art: ?
- [This notebook implements in Python a generator of small "identicon" like the dislayed on GitHub for users without profile pictures](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/An_Identiconizer_generator_implementation_in_Python.ipynb) ([on GitHub?](An_Identiconizer_generator_implementation_in_Python.ipynb)) :sparkles:. See this example:

![art/identicons.png](art/identicons.png)

- :fr: [Ce notebook montre comment générer des fausses citations latines du Roi Loth](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Generer_des_fausses_citations_latines_du_Roi_Loth.ipynb), avec une chaîne de Markov, la liste de locutions latines extraite de Wikipédia, et la liste des vraies citations latines du Roi Loth extraite de Wikiquote. Exemples :

![art/citation_du_roi_Loth_aleatoires.png](art/citation_du_roi_Loth_aleatoires.png)

> I will try to write more *artistic* notebooks, showcasing nice pieces of *code* :art:!

### Experiments with Python
- [This small notebook](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb) ([on GitHub?](Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb)) is a fun experiment, where I tried to use [James Powell (@dutc)](https://GitHub.com/dutc) [rwatch](https://GitHub.com/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](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb) ([on GitHub?](Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb)) 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](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Profiling_in_a_Jupyter_notebook.ipynb) ([on GitHub?](Profiling_in_a_Jupyter_notebook.ipynb)) from *inside* the Jupyter notebook interface, with various approaches.

## Experiments with Jupyter
- [This notebook shows how to register a custom HTML writer for builtins or user-defined types in IPython and Jupyter](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demonstration%20of%20numpy.polynomial.Polynomial%20and%20nice%20display%20with%20LaTeX%20and%20MathJax%20%28python3%29.ipynb) ([on GitHub?](Demonstration%20of%20numpy.polynomial.Polynomial%20and%20nice%20display%20with%20LaTeX%20and%20MathJax%20%28python3%29.ipynb)), for the sake of the example I wrote a nice LaTeX/MathJax-powered print function that nicely displays polynomials from the numpy.polynomial.Polynomial module or class.

- [A small benchmark between Python, Pypy and Julia for the Romberg numerical integration algorithm](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Benchmark_between_Python_and_Julia.ipynb) ([on GitHub?](Benchmark_between_Python_and_Julia.ipynb)). Julia is the fastest, but Pypy is very fast too :snake: !

- Demo of the [RISE Jupyter extension](https://github.com/damianavila/RISE) to easily write a dynamic slideshow in a Jupyter notebook, [for Python](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb) ([on GitHub?](Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb)) and
[for OCaml](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb) ([on GitHub?](Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb)) :loudspeaker:.

## With [Julia](https://www.julialang.org/)
- [This notebook shows a implementation of a naive algorithm to compute eigen values and eigen vectors for full rank matrices](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.ipynb) ([on GitHub?](Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.ipynb), on Julia.

## 🐫 [OCaml](https://www.ocaml.org/)
- Some notebooks are written in French :fr:, mainly [documents written for the preparation](agreg/) to the highly competitive French national exam to become a professor (aka the ["agrégation"](http://agreg.org/)), as since 2016 I am [a teaching assistant](https://www.irisa.fr/fr/emplois/enseignants/missions-denseignement-au-departement-informatique-lens-rennes) at [ENS de Rennes](http://www.ens-rennes.fr/) in the [Computer Science department](http://www.dit.ens-rennes.fr/), for the ["Fundamental Computer Science" minor option (D) for the agrégation exam](http://www.dit.ens-rennes.fr/agregation-option-d/). :fr: Voir [ce sous-dossier](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/agreg/) ([ou sur GitHub](agreg/)) / :gb: See [this sub-folder](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/agreg/) ([or on GitHub](agreg/)).

> And more will come... soon! :bullettrain_front:

----

## 1. *How to read these documents*?

### 1.a. View the notebooks statically :memo:
- Either directly in GitHub: [see the list of notebooks](https://github.com/Naereen/notebooks/search?l=jupyter-notebook);
- Or on [nbviewer.jupiter.org](https://nbviewer.jupiter.org/): [list of notebooks](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/).

### 1.b. Play with the notebooks dynamically :boom:

Anyone can use the [mybinder.org](http://mybinder.org/) website (by [clicking](http://mybinder.org/repo/Naereen/notebooks) 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.

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

----

## 2. *Requirements to run the notebooks locally*?
All [the requirements](requirements.txt) can be installed with [pip](https://pip.readthedocs.io/) and by running a few python -m ... commands.

> Note: if you use [Python 3](https://docs.python.org/3/) instead of [Python 2](https://docs.python.org/2/), you *might* have to *replace* pip and python by pip3 and python3 in the next commands (if both pip and pip3 are installed).

### 2.a. [Jupyter Notebook](http://jupyter.readthedocs.org/en/latest/install.html) and [IPython](http://ipython.org/)

bash
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:

bash
$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):

#### 2.b.1. [GNU Bash kernel](https://github.com/takluyver/bash_kernel)
- You have to have [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) installed ([already there](https://tiswww.case.edu/php/chet/bash/bashtop.html) on all Linux distribution, installable with [brew](http://brew.sh/) or [macports](https://www.macports.org/) on Mac OS, available on Windows through [cygwin](http://cygwin.org/)):

bash
$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: bash sudo pip install bash_kernel python -m bash_kernel.install  #### 2.b.2. [GNU Octave kernel](https://github.com/calysto/octave_kernel) - You have to have [octave](https://www.gnu.org/software/octave/) installed (installable with the package manager on major Linux distributions (apt-get, pacman, yum etc), installable with [brew](http://brew.sh/) or [macports](https://www.macports.org/) on Mac OS, available on Windows through [cygwin](http://cygwin.org/) or [natively](https://ftp.gnu.org/gnu/octave/windows/)): bash$ 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):

bash
$gnuplot --version | head -n1 gnuplot 5.0 patchlevel 1  - And then install the kernel bash_kernel with these *two* commands: bash sudo pip install octave_kernel python -m octave_kernel.install  #### 2.b.3. [OCaml kernel: OCaml-Jupyter](https://github.com/akabe/ocaml-jupyter) It is quite easy to install, with [opam](https://opam.ocaml.org/): bash opam install jupyter  > I started by using this [OCaml kernel called IOCaml](https://github.com/andrewray/iocaml/wiki/jupyter). > The instructions were not so simple, cf. the tutorial by @andrewray on [iocaml's wiki](https://github.com/andrewray/iocaml/wiki/). > It was prone to some bugs, and [I had to manually implement a script](https://github.com/Naereen/fix-iocaml-notebook-exports-to-pdf) to be able to convert the notebooks to PDF with jupyter-nbconvert --to pdf. > Note that [I also had to write a custom Exporter](https://github.com/Naereen/Jupyter-NBConvert-OCaml/) for jupyter-nbconvert in order to convert the notebooks to OCaml scripts (.ml). ---- ### :information_desk_person: More information? > - More information about [notebooks (on the documentation of IPython)](https://nbviewer.jupiter.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb) or [on the FAQ on Jupyter's website](https://nbviewer.jupyter.org/faq). > - More information about [mybinder.org](http://mybinder.org/): on [this example repository](https://github.com/binder-project/example-requirements). ## :scroll: License ? [![GitHub license](https://img.shields.io/github/license/Naereen/notebooks.svg)](https://github.com/Naereen/notebooks/blob/master/LICENSE) All the notebooks in this repository are published under the terms of the [MIT License](https://lbesson.mit-license.org/) (file [LICENSE.txt](LICENSE.txt)). © [Lilian Besson](https://GitHub.com/Naereen), 2016-18. [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/notebooks/graphs/commit-activity) [![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://GitHub.com/Naereen/ama) [![Analytics](https://ga-beacon.appspot.com/UA-38514290-17/github.com/Naereen/notebooks/README.md?pixel)](https://GitHub.com/Naereen/notebooks/) [![ForTheBadge uses-badges](http://ForTheBadge.com/images/badges/uses-badges.svg)](http://ForTheBadge.com) [![ForTheBadge uses-git](http://ForTheBadge.com/images/badges/uses-git.svg)](https://GitHub.com/) [![ForTheBadge built-with-science](http://ForTheBadge.com/images/badges/built-with-science.svg)](https://GitHub.com/Naereen/)  NameLast modifiedSizeDescription Parent Directory - Root of the website (in English or in French) simus/2018-11-27 14:48 - euler/2018-11-27 14:48 - datachallenges/2017-09-21 18:56 - data/2018-07-02 15:22 - art/2018-02-26 16:09 - agreg/2020-01-28 09:57 - rwatch.so2017-05-13 22:29 453K requirements.txt2019-09-09 16:02 153 kullback.py2018-01-09 17:31 18K kullback.cpython-36m-x86_64-linux-gnu.so2017-10-28 10:52 54KSome configuration files for my use of the Python programming language export.sh2017-03-14 19:04 720 Verification_de_numeros_CB_RIB_NIRPP_IBAN.py2018-02-02 15:28 14K Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb2018-02-02 15:28 35K Verification_de_numeros_CB_RIB_NIRPP_IBAN.html2018-03-09 11:30 324KVerification_de_numeros_CB_RIB_NIRPP_IBAN Tutorial on head and tail (bash).sh2017-10-06 14:00 606 Tutorial on head and tail (bash).pdf2017-05-04 13:47 30K Tutorial on head and tail (bash).ipynb2017-11-23 19:30 12K Tutorial on head and tail (bash).html2018-03-09 11:30 262KTutorial on head and tail (bash) Testing_the_lolviz_Python_module.py2018-07-02 15:22 5.1K Testing_the_lolviz_Python_module.ipynb2018-07-02 15:21 153K Testing_the_lolviz_Python_module.html2018-07-02 15:22 391KTesting_the_lolviz_Python_module Test_for_Binder__access_local_packages.ipynb2018-07-16 14:45 6.0K Test_for_Binder__access_local_packages.html2018-07-16 14:46 253KTest_for_Binder__access_local_packages Solving_an_equation_and_the_Lambert_W_function.py2018-01-31 15:03 13K Solving_an_equation_and_the_Lambert_W_function.ipynb2018-01-31 15:03 406K Solving_an_equation_and_the_Lambert_W_function.html2018-03-09 11:30 697KSolving_an_equation_and_the_Lambert_W_function Simulations du jeu de carte Jap-Jap.py2019-08-23 12:02 25K Simulations du jeu de carte Jap-Jap.ipynb2019-08-23 15:22 60K Simulated_annealing_in_Python.py2017-10-06 14:02 8.2K Simulated_annealing_in_Python.ipynb2017-07-20 18:52 563K Simulated_annealing_in_Python.html2018-03-09 11:30 820KSimulated_annealing_in_Python Short_study_of_the_Lempel-Ziv_complexity.py2017-10-06 14:02 20K Short_study_of_the_Lempel-Ziv_complexity.ipynb2017-07-01 11:47 189K Short_study_of_the_Lempel-Ziv_complexity.html2018-03-09 11:30 471KShort_study_of_the_Lempel-Ziv_complexity Runge-Kutta_methods_for_ODE_integration_in_Python.py2017-11-23 19:31 13K Runge-Kutta_methods_for_ODE_integration_in_Python.ipynb2017-11-24 21:48 406K Runge-Kutta_methods_for_ODE_integration_in_Python.html2018-03-09 11:30 699KRunge-Kutta_methods_for_ODE_integration_in_Python Runge-Kutta_methods_for_ODE_integration_in_OCaml.ml2017-11-26 16:46 12K Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb2017-11-26 16:46 598K Runge-Kutta_methods_for_ODE_integration_in_OCaml.html2018-03-09 11:30 887KRunge-Kutta_methods_for_ODE_integration_in_OCaml Runge-Kutta_methods_for_ODE_integration_in_Julia.jl2017-11-25 13:38 5.8K Runge-Kutta_methods_for_ODE_integration_in_Julia.ipynb2017-11-25 13:37 2.5M Runge-Kutta_methods_for_ODE_integration_in_Julia.html2018-03-09 11:30 2.3MRunge-Kutta_methods_for_ODE_integration_in_Julia Py_Pi_Day_2017.py2017-10-06 14:01 42K Py_Pi_Day_2017.ipynb2017-05-29 19:16 80K Py_Pi_Day_2017.html2018-03-09 11:30 395KPy_Pi_Day_2017 Profiling_in_a_Jupyter_notebook.ipynb2017-05-23 01:46 17K Profiling_in_a_Jupyter_notebook.html2018-03-09 11:30 277KProfiling_in_a_Jupyter_notebook Oraux_CentraleSupelec_PSI__Juin_2019.py2019-05-24 10:45 28K Oraux_CentraleSupelec_PSI__Juin_2019.ipynb2019-05-24 10:09 530K Oraux_CentraleSupelec_PSI__Juin_2019.html2019-05-24 10:45 874KOraux_CentraleSupelec_PSI__Juin_2019 Oraux_CentraleSupelec_PSI__Juin_2018.py2018-06-10 01:32 28K Oraux_CentraleSupelec_PSI__Juin_2018.ipynb2018-06-10 01:28 299K Oraux_CentraleSupelec_PSI__Juin_2018.html2018-06-10 01:32 613KOraux_CentraleSupelec_PSI__Juin_2018 Oraux_CentraleSupelec_PSI__Juin_2017.py2017-10-06 14:01 22K Oraux_CentraleSupelec_PSI__Juin_2017.ipynb2017-06-02 14:03 227K Oraux_CentraleSupelec_PSI__Juin_2017.html2018-03-09 11:30 516KOraux_CentraleSupelec_PSI__Juin_2017 Obfuscated_code_or_piece_of_art.py2017-10-06 14:00 6.0K Obfuscated_code_or_piece_of_art.pdf2017-05-04 13:50 895K Obfuscated_code_or_piece_of_art.ipynb2017-03-18 11:38 10K Obfuscated_code_or_piece_of_art.html2018-03-09 11:30 257KObfuscated_code_or_piece_of_art NetHack's functions Rne, Rn2 and Rnz in Python 3.py2018-01-04 16:51 5.0K NetHack's functions Rne, Rn2 and Rnz in Python 3.ipynb2018-01-04 16:43 45K NetHack's functions Rne, Rn2 and Rnz in Python 3.html2018-03-09 11:30 308KNetHack's functions Rne, Rn2 and Rnz in Python 3 Merge-k-sorted-lists.py2017-10-06 14:02 1.5K Merge-k-sorted-lists.pdf2017-08-28 15:28 22K Merge-k-sorted-lists.ipynb2017-08-28 15:27 3.3K Merge-k-sorted-lists.html2018-03-09 11:30 254KMerge-k-sorted-lists Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.py2018-07-13 15:33 59K Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.pdf2017-05-04 13:50 1.2M Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb2018-11-22 14:23 2.9M Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.html2018-07-13 15:33 3.2MManual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_ Manual_implementation_of_some_hash_functions.py2017-10-06 14:01 65K Manual_implementation_of_some_hash_functions.ipynb2017-06-21 12:50 105K Manual_implementation_of_some_hash_functions.html2018-03-09 11:30 523KManual_implementation_of_some_hash_functions Living_in_a_noisy_world_with_James_Powell_rwatch_module.py2017-10-06 14:00 15K Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb2017-05-14 14:23 36K Living_in_a_noisy_world_with_James_Powell_rwatch_module.html2018-03-09 11:30 317KLiving_in_a_noisy_world_with_James_Powell_rwatch_module LeconsInfos19.pdf2018-09-18 13:29 44K LICENSE.txt2016-06-25 11:01 1.1K LICENSE2018-09-18 11:22 1.1K Kullback_Leibler_divergences_in_native_Python__Cython_and_Numba.py2018-04-27 16:22 50K Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.py2018-04-27 16:22 50K Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb2018-04-27 16:21 116K Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.html2018-04-27 16:22 514KKullback-Leibler_divergences_in_native_Python__Cython_and_Numba Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.py2018-01-17 15:12 51K Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.pdf2018-01-10 19:10 1.9M Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.ipynb2018-01-17 14:41 2.8M Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.html2018-03-09 11:30 3.1MIntroduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling Hierarchie_de_Grzegorczyk.tex2019-02-26 15:15 13K Hierarchie_de_Grzegorczyk.pdf2019-02-26 15:17 306K Generer_des_fausses_citations_latines_du_Roi_Loth.py2018-12-04 11:00 14K Generer_des_fausses_citations_latines_du_Roi_Loth.ipynb2018-12-04 11:00 32K Generer_des_fausses_citations_latines_du_Roi_Loth.html2018-12-04 11:00 301KGenerer_des_fausses_citations_latines_du_Roi_Loth Generating_permutations_with_Python.py2017-10-06 14:00 17K Generating_permutations_with_Python.ipynb2017-11-14 14:25 35K Generating_permutations_with_Python.html2018-03-09 11:30 317KGenerating_permutations_with_Python Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.py2017-10-06 14:01 8.3K Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb2017-05-17 20:25 27K Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.html2018-03-09 11:30 296KFloating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform Exponential_Integral_Python.py2018-01-24 11:13 9.8K Exponential_Integral_Python.ipynb2018-01-24 11:03 546K Exponential_Integral_Python.html2018-03-09 11:30 829KExponential_Integral_Python Efficient_sampling_from_a_Binomial_distribution.py2019-02-28 15:26 22K Efficient_sampling_from_a_Binomial_distribution.ipynb2019-02-28 15:26 214K Efficient_sampling_from_a_Binomial_distribution.html2019-02-28 15:26 501KEfficient_sampling_from_a_Binomial_distribution Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.py2019-02-26 11:04 1.4K Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.ipynb2019-02-26 11:03 4.6K Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.html2019-02-26 11:04 252KDemonstration_of_running_a_Jupyter_notebook_with_sudo_rights Demonstration of numpy.polynomial.Polynomial and nice display with LaTeX and MathJax (python3).ipynb2018-11-27 14:48 21KSome configuration files for my use of the Python programming language Demonstration of numpy.polynomial.Polynomial and nice display with LaTeX and MathJax (python3).html2018-11-27 14:48 288KSome configuration files for my use of the Python programming language Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.pdf2017-09-21 12:25 67KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb2017-09-21 11:54 9.3KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.html2018-03-09 11:30 260KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.pdf2017-09-21 12:25 63KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb2017-09-21 12:11 8.3KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.html2018-03-09 11:30 257KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__Julia.ipynb2018-02-02 15:08 11KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org Demo_of_RISE_for_slides_with_Jupyter_notebooks__Julia.html2018-03-09 11:30 261KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org DM_Images_debut.py2019-01-08 17:55 4.8K DM_Images_debut.ipynb2019-01-08 17:54 1.6M DM_Images_debut.html2019-01-08 17:55 1.8MDM_Images_debut ChaCha_PseudoRandom_number_generator.ipynb2019-03-04 13:59 7.4K Blurring_a_part_of_an_image_in_Python.py2018-04-22 15:49 2.6K Blurring_a_part_of_an_image_in_Python.ipynb2018-03-09 11:31 1.1M Blurring_a_part_of_an_image_in_Python.html2018-04-22 15:49 1.4MBlurring_a_part_of_an_image_in_Python Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.py2017-10-06 14:01 35K Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.ipynb2017-06-21 13:41 78K Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.html2018-03-09 11:30 415KBenchmark_of_the_SHA256_hash_function__Python_Cython_Numba Benchmark_between_Python_and_Julia.py2017-10-06 14:01 25K Benchmark_between_Python_and_Julia.ipynb2017-06-30 14:07 60K Benchmark_between_Python_and_Julia.html2018-03-09 11:30 344KBenchmark_between_Python_and_Julia Basic_plotting_and_matrix_operations__Octave__with_RISE_slides.ipynb2017-11-23 19:31 577KCommon repository for remark.js slideshows, open-source on GitHub. Readables on naereen.github.io/slides Basic_plotting_and_matrix_operations__Octave__with_RISE_slides.html2018-03-09 11:30 827KCommon repository for remark.js slideshows, open-source on GitHub. Readables on naereen.github.io/slides Basic plotting and matrix operations (Octave).pdf2017-06-21 10:08 333K Basic plotting and matrix operations (Octave).m2017-11-23 19:30 1.2K Basic plotting and matrix operations (Octave).ipynb2017-11-23 19:30 575K Basic plotting and matrix operations (Octave).html2019-09-17 12:25 849KBasic plotting and matrix operations (Octave) An_Identiconizer_generator_implementation_in_Python.py2017-11-26 12:09 7.0K An_Identiconizer_generator_implementation_in_Python.ipynb2017-11-26 12:08 64K An_Identiconizer_generator_implementation_in_Python.html2019-09-17 12:25 361KAn_Identiconizer_generator_implementation_in_Python Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.jl2018-04-30 18:56 5.0K Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.ipynb2018-04-30 18:55 41K Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.html2019-09-17 12:25 356KAlgorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia Algorithmes_pour_l_ecriture_inclusive.ipynb2018-12-26 21:46 9.6K Algorithmes_pour_l_ecriture_inclusive.html2019-09-17 12:25 285KAlgorithmes_pour_l_ecriture_inclusive Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.py2018-07-03 14:47 9.1K Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.ipynb2018-07-03 14:46 90K Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.html2019-09-17 12:25 375KAlgebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis A_short_study_of_Renyi_entropy.py2018-11-22 14:50 5.3K A_short_study_of_Renyi_entropy.pdf2018-11-22 14:50 100K A_short_study_of_Renyi_entropy.ipynb2018-11-22 14:49 103K A_short_study_of_Renyi_entropy.html2019-09-17 12:25 387KA_short_study_of_Renyi_entropy # [Jupyter Notebooks](http://jupyter.org/) :notebook: by [Naereen @ GitHub](https://naereen.github.io/) This repository hosts some [Jupyter Notebooks](http://jupyter.org/), covering various subjects. Go to [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/) to read them. You can also launch an interactive environment to play with the code by yourself, using one of these platforms: [![MyBinder v2](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Naereen/notebooks/master) [![Google Colab: Launch](https://img.shields.io/badge/Google%20Colab-Launch-blue.svg)](https://colab.research.google.com/github/Naereen/notebooks/blob/master/) > At the beginning, this repository was only here to host some small experiments, for me to learn how to use [the wonderful Jupyter tools](http://jupyter.org/) correctly (baby notebooks :baby_bottle:)... ## :shell: Bash - The first notebooks I wrote are small tutorials for :shell: bash commands (or some of my [command-line scripts](https://bitbucket.org/lbesson/bin/src/master/)), see for example [a tutorial on head and a tail](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Tutorial%20on%20head%20and%20tail%20%28bash%29.ipynb) ([on GitHub?](Tutorial%20on%20head%20and%20tail%20%28bash%29.ipynb)). ## :snake: Python > I am a passionate user of [the Python programming language](https://www.python.org/). ### Science - [This notebook written for the Pi Day 2017](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Py_Pi_Day_2017.ipynb) ([on GitHub?](Py_Pi_Day_2017.ipynb)) demonstrates a dozen of easy algorithms to compute from 10 to 100000 digits of the *number pi*. - [This notebook implements a simple example of the *simulated annealing* algorithm](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Simulated_annealing_in_Python.ipynb) ([on GitHub?](Simulated_annealing_in_Python.ipynb)) to minimize black-box functions :sunglasses:. - [This notebook shows a hand-written and clear implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Manual_implementation_of_some_hash_functions.ipynb) ([on GitHub?](Manual_implementation_of_some_hash_functions.ipynb)) of several [Hashing functions](https://docs.python.org/3/library/hashlib.html), like MD5, SHA1, and all variants of SHA2 (SHA256, SHA224, SHA512, SHA384). - [This notebook shows a manual implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Short_study_of_the_Lempel-Ziv_complexity.ipynb) ([on GitHub?](Short_study_of_the_Lempel-Ziv_complexity.ipynb)) of the [Lempel-Ziv complexity](https://en.wikipedia.org/wiki/Lempel-Ziv_complexity) in pure Python, and then as optimized Python code, with Cython or Numba. I also wrote a version in [Julia](http://julialang.org) (in the same notebook), and compare the 4 implementations! I then published my code as a Pypy package, see [here on pypi.org](https://pypi.org/project/Lempel-Ziv_Complexity/). - [This notebook shows a hand-written and clear implementation](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb) ([on GitHub?](Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb)) of several [Pseudo-Random Number Generators](https://docs.python.org/3/library/random.html), including the famous *Mersenne twister* algorithm, and then uses it to samples from the most famous discrete and continuous distributions, showcasing use of the Inverse-Transform method and Acceptance-Rejection method (cf. Markov Chain Monte-Carlo methods). - [This notebook implements and compares different Runge-Kutta methods](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_Python.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_Python.ipynb)) for integrating Ordinary Differential Equations in Python. And also [in Julia](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_Julia.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_Julia.ipynb)), and also [in OCaml](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb) ([on GitHub?](Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb)). I wanted to compare the three languages for the same algorithms. Well, obviously, Julia is the fastest and simplest for numerical simulations like this. - :fr: [Ce petit notebook en français](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb) ([sur GitHub ?](Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb)) implémente les algorithmes de vérifications des numéros de cartes bleues, de sécurité sociale et d'IBAN en Python. - [This notebook implements and explore the Exponential Integral function Ei(x)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Exponential_Integral_Python.ipynb) ([on GitHub?](Exponential_Integral_Python.ipynb)). - [This notebook shows how to solve the equation exp(- a x²)=x both numerically and formally (with the Lambert W function)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Solving_an_equation_and_the_Lambert_W_function.ipynb) ([on GitHub?](Solving_an_equation_and_the_Lambert_W_function.ipynb)). - [This notebook implements Kullback-Leibler divergences for some parametric distributions, and KL-UCB indexes, in naive Python and compare with optimized versions using JIT compilation by Numba or C compilation by Cython](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb) ([on GitHub?](Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb)). - [This short notebook defines and studies the Rényi entropy](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/A_short_study_of_Renyi_entropy.ipynb) ([on GitHub?](A_short_study_of_Renyi_entropy.ipynb)). ### Teaching - :fr: [Ce notebook en français présente les problèmes de bandits multi-bras stochastiques](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.ipynb) ([on GitHub?](Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.ipynb)) (*multi-armed bandit*, MAB), et les algorithmes dits "de bandits" pour les résoudre (UCB "Upper Confidence Bounds", KL-UCB, Thompson Sampling, Approximated Finite-Horizon Gittins index etc). C'est une bonne introduction aux outils que j'utilise pour [ma thèse](http://perso.crans.org/besson/phd/). - :fr: I corrected some maths & programming problems from the annals of the [CentraleSupelec national competitive](http://www.concours-centrale-supelec.fr/) exam (in France), in this notebook [Oraux_CentraleSupelec_PSI__Juin_2017.ipynb](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Oraux_CentraleSupelec_PSI__Juin_2017.ipynb) ([on GitHub?](Oraux_CentraleSupelec_PSI__Juin_2017.ipynb)) (for [this kind of oral exam](http://www.concours-centrale-supelec.fr/CentraleSupelec/MultiY/C2015/)). Again in 2018, [Oraux_CentraleSupelec_PSI__Juin_2018.ipynb](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Oraux_CentraleSupelec_PSI__Juin_2018.ipynb) ([on GitHub?](Oraux_CentraleSupelec_PSI__Juin_2018.ipynb)). ### Numerical simulations for dice games (:fr: in French) - I also wrote some notebooks on numerical simulations of dice games :fr: Voir [ce sous-dossier](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/simus/) (ou [sur GitHub?](simus/)) / :gb: See [this sub-folder](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/simus/) (or [on GitHub?](simus/)). ### :art: Art - [This notebook shows some "obfuscated" code, producing](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Obfuscated_code_or_piece_of_art.ipynb) ([on GitHub?](Obfuscated_code_or_piece_of_art.ipynb)) :sparkles: [nice figures](art/)... Or maybe they are pieces of code art :art: ? - [This notebook implements in Python a generator of small "identicon" like the dislayed on GitHub for users without profile pictures](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/An_Identiconizer_generator_implementation_in_Python.ipynb) ([on GitHub?](An_Identiconizer_generator_implementation_in_Python.ipynb)) :sparkles:. See this example: ![art/identicons.png](art/identicons.png) - :fr: [Ce notebook montre comment générer des fausses citations latines du Roi Loth](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Generer_des_fausses_citations_latines_du_Roi_Loth.ipynb), avec une chaîne de Markov, la liste de locutions latines extraite de Wikipédia, et la liste des vraies citations latines du Roi Loth extraite de Wikiquote. Exemples : ![art/citation_du_roi_Loth_aleatoires.png](art/citation_du_roi_Loth_aleatoires.png) > I will try to write more *artistic* notebooks, showcasing nice pieces of *code* :art:! ### Experiments with Python - [This small notebook](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb) ([on GitHub?](Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb)) is a fun experiment, where I tried to use [James Powell (@dutc)](https://GitHub.com/dutc) [rwatch](https://GitHub.com/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](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb) ([on GitHub?](Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb)) 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](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Profiling_in_a_Jupyter_notebook.ipynb) ([on GitHub?](Profiling_in_a_Jupyter_notebook.ipynb)) from *inside* the Jupyter notebook interface, with various approaches. ## Experiments with Jupyter - [This notebook shows how to register a custom HTML writer for builtins or user-defined types in IPython and Jupyter](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demonstration%20of%20numpy.polynomial.Polynomial%20and%20nice%20display%20with%20LaTeX%20and%20MathJax%20%28python3%29.ipynb) ([on GitHub?](Demonstration%20of%20numpy.polynomial.Polynomial%20and%20nice%20display%20with%20LaTeX%20and%20MathJax%20%28python3%29.ipynb)), for the sake of the example I wrote a nice LaTeX/MathJax-powered print function that nicely displays polynomials from the numpy.polynomial.Polynomial module or class. - [A small benchmark between Python, Pypy and Julia for the Romberg numerical integration algorithm](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Benchmark_between_Python_and_Julia.ipynb) ([on GitHub?](Benchmark_between_Python_and_Julia.ipynb)). Julia is the fastest, but Pypy is very fast too :snake: ! - Demo of the [RISE Jupyter extension](https://github.com/damianavila/RISE) to easily write a dynamic slideshow in a Jupyter notebook, [for Python](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb) ([on GitHub?](Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb)) and [for OCaml](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb) ([on GitHub?](Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb)) :loudspeaker:. ## With [Julia](https://www.julialang.org/) - [This notebook shows a implementation of a naive algorithm to compute eigen values and eigen vectors for full rank matrices](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.ipynb) ([on GitHub?](Algorithms_to_compute_eigen_values_and_eigen_vectors_in_Julia.ipynb), on Julia. ## 🐫 [OCaml](https://www.ocaml.org/) - Some notebooks are written in French :fr:, mainly [documents written for the preparation](agreg/) to the highly competitive French national exam to become a professor (aka the ["agrégation"](http://agreg.org/)), as since 2016 I am [a teaching assistant](https://www.irisa.fr/fr/emplois/enseignants/missions-denseignement-au-departement-informatique-lens-rennes) at [ENS de Rennes](http://www.ens-rennes.fr/) in the [Computer Science department](http://www.dit.ens-rennes.fr/), for the ["Fundamental Computer Science" minor option (D) for the agrégation exam](http://www.dit.ens-rennes.fr/agregation-option-d/). :fr: Voir [ce sous-dossier](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/agreg/) ([ou sur GitHub](agreg/)) / :gb: See [this sub-folder](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/agreg/) ([or on GitHub](agreg/)). > And more will come... soon! :bullettrain_front: [![made-with-jupyter](https://img.shields.io/badge/Made%20with-Jupyter-1f425f.svg)](http://jupyter.org/) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![made-with-ocaml](https://img.shields.io/badge/Made%20with-OCaml-1f425f.svg)](https://ocaml.org/) [![made-with-julia](https://img.shields.io/badge/Made%20with-Julia-1f425f.svg)](https://julialang.org/) ---- ## 1. *How to read these documents*? ### 1.a. View the notebooks statically :memo: - Either directly in GitHub: [see the list of notebooks](https://github.com/Naereen/notebooks/search?l=jupyter-notebook); - Or on [nbviewer.jupiter.org](https://nbviewer.jupiter.org/): [list of notebooks](https://nbviewer.jupyter.org/github/Naereen/notebooks/tree/master/). ### 1.b. Play with the notebooks dynamically :boom: [![MyBinder](http://mybinder.org/badge.svg)](http://mybinder.org/repo/Naereen/notebooks) Anyone can use the [mybinder.org](http://mybinder.org/) website (by [clicking](http://mybinder.org/repo/Naereen/notebooks) 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](https://beta.mybinder.org/badge.svg)](https://beta.mybinder.org/v2/gh/Naereen/notebooks/master) > *Note:* Only the Python kernel is supported on the MyBinder interface! ---- ## 2. *Requirements to run the notebooks locally*? All [the requirements](requirements.txt) can be installed with [pip](https://pip.readthedocs.io/) and by running a few python -m ... commands. > Note: if you use [Python 3](https://docs.python.org/3/) instead of [Python 2](https://docs.python.org/2/), you *might* have to *replace* pip and python by pip3 and python3 in the next commands (if both pip and pip3 are installed). ### 2.a. [Jupyter Notebook](http://jupyter.readthedocs.org/en/latest/install.html) and [IPython](http://ipython.org/) bash 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: bash$ 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): #### 2.b.1. [GNU Bash kernel](https://github.com/takluyver/bash_kernel) - You have to have [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) installed ([already there](https://tiswww.case.edu/php/chet/bash/bashtop.html) on all Linux distribution, installable with [brew](http://brew.sh/) or [macports](https://www.macports.org/) on Mac OS, available on Windows through [cygwin](http://cygwin.org/)): bash$ 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:

bash
sudo pip install bash_kernel
python -m bash_kernel.install


#### 2.b.2. [GNU Octave kernel](https://github.com/calysto/octave_kernel)
- You have to have [octave](https://www.gnu.org/software/octave/) installed (installable with the package manager on major Linux distributions (apt-get, pacman, yum etc), installable with [brew](http://brew.sh/) or [macports](https://www.macports.org/) on Mac OS, available on Windows through [cygwin](http://cygwin.org/) or [natively](https://ftp.gnu.org/gnu/octave/windows/)):

bash
$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): bash$ gnuplot --version | head -n1
gnuplot 5.0 patchlevel 1


- And then install the kernel bash_kernel with these *two* commands:

bash
sudo pip install octave_kernel
python -m octave_kernel.install


#### 2.b.3. [OCaml kernel: OCaml-Jupyter](https://github.com/akabe/ocaml-jupyter)
It is quite easy to install, with [opam](https://opam.ocaml.org/):
bash
opam install jupyter


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

----

> - More information about [notebooks (on the documentation of IPython)](https://nbviewer.jupiter.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb) or [on the FAQ on Jupyter's website](https://nbviewer.jupyter.org/faq).