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

This repository hosts *a lot of* [Jupyter Notebooks](http://jupyter.org/), covering various subjects.
Everything is open-sourced under [the MIT License](https://lbesson.mit-license.org/), you can use any of these notebooks for your own teaching activities if you want. Please [open an issue](https://github.com/Naereen/notebooks/issues/new), or [ask me anything](https://github.com/Naereen/ama) or [drop an email](https://besson.link/callme.en.html) if you have any questions, suggestions, or more.

*Which languages?* Half of the notebooks here are in :gb: English, and the other half in :fr: French (surtout pour *l'agrégation de mathématiques option informatique*, dans ce dossier [`agreg/`](agreg/)), and most use [the Python language](https://www.Python.org/), or [OCaml](https://OCaml.org), and a few notebooks use other languages like Julia, Rust, Java or even Bash, C and Octave!

## How to read or use these notebooks?
You can view this repository on [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/) to read notebooks statically, or read them directly from GitHub.

You can also launch an interactive environment to play with the code by yourself, using one of these platforms:
- MyBinder should work fine even for OCaml notebooks, but it's quite slow. It's fully open-source, and reliable: [![MyBinder v2](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Naereen/notebooks/master)
- Google Colab should work only for Python notebooks, but it's blazing fast to load. It's not open-source and requires to use Google's servers: [![Google Colab: Launch](https://img.shields.io/badge/Google%20Colab-Launch-blue.svg)](https://colab.research.google.com/github/Naereen/notebooks/blob/master/)

- **New!** In Feb'21, [I have installed](https://github.com/Naereen/Mon-utilisation-de-Basthon/) the amazing [Basthon notebook](https://basthon.fr/about.html) to my website, at <http://notebook.besson.link/>, and you can use it with any of the notebooks available in the repository, for instance <https://besson.link/Basthon/notebook/?from=../../publis/notebooks/Py_Pi_Day_2017.ipynb> for [`Py_Pi_Day_2017.ipynb`](Py_Pi_Day_2017.ipynb), because this folder is synced on my website at <https://besson.link/publis/notebooks/>. Please [open an issue](https://github.com/Naereen/notebooks/issues/new) if this doesn't work!

## My use of notebooks - short story since 2015

- At the beginning (as early as end of 2015!), 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. So they were baby notebooks :baby_bottle:... Since then, I did *a lot of experiments*, on all the most important kernels (Python, Julia, but also less standard ones like OCaml, Rust, Java, C, Bash, etc), all the most exciting notebook extensions, and output formats (PDF, script, static HTML, slides, etc). I've kept learning and discovering more [awesomeness of the Jupyter environment](https://github.com/markusschanta/awesome-jupyter), and it never stops to amaze me :sparkles:!
- In the last 5 years (2016-2021), I've used Jupyter notebooks intensively, to teach algorithmics, programming, and (not so theoretical) computer science in general, mainly in :fr: French. I wrote notebooks to teach [introduction to Java in 2020](https://perso.crans.org/besson/teach/INF1_L1_Rennes1_2020-21/), [advanced algorithms using Python in 2019](https://github.com/Naereen/ALGO1-Info1-2019), and a lot for experimenting during [my PhD thesis](https://perso.crans.org/besson/phd/).
- :fr: J'ai aussi corrigé *tous* les textes d'annales de modélisation, en option informatique, pour le concours national de l'agrégation de maths, en utilisant OCaml ou des fois Python ! Ce sont les seuls corrigés de ce type disponibles sur tous les Internets (j'ai cherché partout !), et ils sont dans ce dossier : [`agreg/`](agreg/). [Je compte]() déplacer ça dans un dossier à part, et bien les nettoyer et mettre à jour, en 2021.
- I love the Jupyter environment, from the old [IPython command line](https://ipython.org/) to the recent [awesome](https://github.com/mauhai/awesome-jupyterlab) [Jupyter Lab](https://github.com/jupyterlab/jupyterlab). If you want to discover amazing things, check out: [RISE for live slides in a notebook](https://rise.readthedocs.io/), [lolviz](https://github.com/parrt/lolviz/) and [rcviz](https://github.com/DamnedFacts/rcviz) and [tutormagic](https://github.com/kikocorreoso/tutormagic/) for nice data structures visualizations in a notebook.

- In the future, **I plan to mostly teach using Jupyter notebooks**, using either the regular Python kernel, the [OCaml-jupyter](https://github.com/akabe/ocaml-jupyter/) kernel for [OCaml](https://ocaml.org) (and also [IJava](https://github.com/SpencerPark/IJava) for Java, [this one for C](https://github.com/brendan-rius/jupyter-c-kernel), and more if needed). RISE slides embed a chalk-board mode, more limited in comparison to the amazing [TableauNoir](https://tableaunoir.github.io/).

## A partial list of notebooks in this repository

I'm trying to maintain here a list of the notebooks stored in this repository, inspired by the amazing [pytudes](https://github.com/norvig/pytudes) by [Peter Norvig](https://github.com/norvig/).
The links open [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/)), and the links ([on GitHub?](https://github.com/Naereen/notebooks/)) open the notebook to be viewed directly in GitHub (it should work for almost all of them).

### :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)).

- :fr: [Ce notebook présente des approches simples pour générer un dictionnaire des mots français adaptés à l'écriture inclusive](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Ecriture%20inclusive.ipynb), comme beau/belle -> beau·elle, professeur/professeure -> professeur·e, il/elle -> iel/ielle etc ([on GitHub?](Ecriture%20inclusive.ipynb)). [Ici ce trouve le dictionnaire généré (contenant environ 26 000 mots différents)](french_inclusive.txt). ~~Work in progress?~~ (je ne terminerai pas, c'est trop compliqué de faire ça parfaitement)

- :fr: En s'inspirant de [cet article](https://kalebujordan.com/make-your-own-plagiarism-detector-in-python/) (décembre 2020), [j'expérimente dans ce notebook avec scikit-learn pour détecter les similarités et les risques de plagiat dans des projets étudiants écrits en Java](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.ipynb) (mais l'approche est indépendante du langage !) ([on GitHub?](My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.ipynb))

- [This long but easy to follow notebook explains how to solve](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Using_Python_to_solve_Regexp_CrossWord_Puzzles.ipynb) the regular expression cross-words from [this website](https://regexcrossword.com/challenges/), as I was struggling to solve [this difficult one (Volapük Lul)](https://regexcrossword.com/challenges/volapuk/puzzles/5) ([on GitHub?](Using_Python_to_solve_Regexp_CrossWord_Puzzles.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)).

- :fr: [Ce notebook en français est un petit tutoriel pour apprendre à résoudre des problèmes/programmes linéaires en Python avec SciPy](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.ipynb), pour le cours [ALGO2](http://people.irisa.fr/Francois.Schwarzentruber/algo2/) à [l'ENS Rennes](http://www.dit.ens-rennes.fr/) en janvier 2021 ([on GitHub?](Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.ipynb)).

- :fr: [Ce notebook en français montre une expérimentation de visualisation interactive de l'algorithme du Simplexe](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Une_exploration_visuelle_de_l_algorithme_du_Simplexe_en_3D_avec_Python.ipynb), pour le cours [ALGO2](http://people.irisa.fr/Francois.Schwarzentruber/algo2/) à [l'ENS Rennes](http://www.dit.ens-rennes.fr/) en février 2021 ([on GitHub?](Une_exploration_visuelle_de_l_algorithme_du_Simplexe_en_3D_avec_Python.ipynb)).

- :fr: [Ce petit notebook en français présente un challenge](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/F%C3%A9vrier%202021%20un%20mini%20challenge%20arithm%C3%A9tico-algorithmique.ipynb) : « Comptez le nombre de mois de février répondant à ce critère (je n'ai pas trouvé de nom précis), depuis l'année de création de l'ENS Rennes (1994, enfin pour Cachan antenne Bretagne) jusqu'à 2077 (1994 et 2077 inclus). ». ([on GitHub?](F%C3%A9vrier%202021%20un%20mini%20challenge%20arithm%C3%A9tico-algorithmique.ipynb)).

- :fr: :bug:  [Ce petit notebook en français montre comment déboguer du code Python depuis Jupyter](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Deboguer_du_code_Python_depuis_Notebook_Jupyter.ipynb) ([on GitHub?](Deboguer_du_code_Python_depuis_Notebook_Jupyter.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)

#### 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.

- 🔍 ✨ I first tried the [`lolviz`](https://github.com/parrt/lolviz/) [module in 2017](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Testing_the_lolviz_Python_module.ipynb) ([on GitHub?](Testing_the_lolviz_Python_module.ipynb)), and then again in 2021, to [improve it](https://github.com/parrt/lolviz/issues/27), [with a unified display function that chooses the best one based on the datatype](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.ipynb) ([on GitHub?](Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.ipynb)).

### 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:.

- :fr: Cette comparaison des deux extensions [`tutormagic`](https://github.com/kikocorreoso/tutormagic/) et [`nbtutor`](https://github.com/lgpage/nbtutor/) dans [ce notebook (20/02/2021)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.ipynb) ([on GitHub?](Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.ipynb))

- :negative_squared_cross_mark: Demonstration of using the [`nbtutor`](https://github.com/lgpage/nbtutor/) extension offline [this other tiny notebook (20/02/2021)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_nbtutor_offline.ipynb) ([on GitHub?](Demo_of_nbtutor_offline.ipynb)) - Failure! TODO:

### With the [C language](https://github.com/brendan-rius/jupyter-c-kernel)

- [An example notebook in C language, showing two approaches to match a regular expression from a large text](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.ipynb) ([on GitHub?](Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.ipynb))

### 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.

You can also launch an interactive environment to play with the code by yourself, using one of these platforms:
- MyBinder should work fine even for OCaml notebooks, but it's quite slow. It's fully open-source, and reliable: [![MyBinder v2](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Naereen/notebooks/master)
- Google Colab should work only for Python notebooks, but it's blazing fast to load. It's not open-source and requires to use Google's servers: [![Google Colab: Launch](https://img.shields.io/badge/Google%20Colab-Launch-blue.svg)](https://colab.research.google.com/github/Naereen/notebooks/blob/master/)

- **New!** In Feb'21, [I have installed](https://github.com/Naereen/Mon-utilisation-de-Basthon/) the amazing [Basthon notebook](https://basthon.fr/about.html) to my website, at <http://notebook.besson.link/>, and you can use it with any of the notebooks available in the repository, for instance <https://besson.link/Basthon/notebook/?from=../../publis/notebooks/Py_Pi_Day_2017.ipynb> for [`Py_Pi_Day_2017.ipynb`](Py_Pi_Day_2017.ipynb), because this folder is synced on my website at <https://besson.link/publis/notebooks/>. Please [open an issue](https://github.com/Naereen/notebooks/issues/new) if this doesn't work!

> *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).

> :warning: I've not updated this section since 2016.

### 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).
> - :fr: Plus d'informations sur [Basthon](https://notebook.basthon.fr/) : <https://basthon.fr/about.html>

## :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-21.

[![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)
[![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/)
[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  - Root of the website (in English or in French)
[DIR]datachallenges/2020-03-13 16:06 -  
[DIR]data/2020-03-13 16:06 -  
[DIR]art/2020-03-13 16:06 -  
[DIR]simus/2020-04-27 12:13 -  
[DIR]euler/2021-01-26 20:42 -  
[DIR]agreg/2021-02-04 14:46 -  
[DIR]NSI/2021-03-11 11:16 -  
[TXT]LICENSE.txt2016-06-25 11:01 1.1K 
[   ]Obfuscated_code_or_piece_of_art.ipynb2017-03-18 11:38 10K 
[   ]Tutorial on head and tail (bash).pdf2017-05-04 13:47 30K 
[   ]Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.pdf2017-05-04 13:50 1.2M 
[   ]Obfuscated_code_or_piece_of_art.pdf2017-05-04 13:50 895K 
[   ]rwatch.so2017-05-13 22:29 453K 
[   ]Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb2017-05-14 14:23 36K 
[   ]Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.ipynb2017-05-17 20:25 27K 
[   ]Profiling_in_a_Jupyter_notebook.ipynb2017-05-23 01:46 17K 
[   ]Py_Pi_Day_2017.ipynb2017-05-29 19:16 80K 
[   ]Oraux_CentraleSupelec_PSI__Juin_2017.ipynb2017-06-02 14:03 227K 
[   ]Basic plotting and matrix operations (Octave).pdf2017-06-21 10:08 333K 
[   ]Manual_implementation_of_some_hash_functions.ipynb2017-06-21 12:50 105K 
[   ]Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.ipynb2017-06-21 13:41 78K 
[   ]Benchmark_between_Python_and_Julia.ipynb2017-06-30 14:07 60K 
[   ]Short_study_of_the_Lempel-Ziv_complexity.ipynb2017-07-01 11:47 189K 
[   ]Simulated_annealing_in_Python.ipynb2017-07-20 18:52 563K 
[   ]Merge-k-sorted-lists.ipynb2017-08-28 15:27 3.3K 
[   ]Merge-k-sorted-lists.pdf2017-08-28 15:28 22K 
[   ]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
[TXT]Generating_permutations_with_Python.py2017-10-06 14:00 17K 
[TXT]Obfuscated_code_or_piece_of_art.py2017-10-06 14:00 6.0K 
[TXT]Living_in_a_noisy_world_with_James_Powell_rwatch_module.py2017-10-06 14:00 15K 
[TXT]Floating_point_error_propagation_in_polynomial_multiplication_with_Fast-Fourier_Transform.py2017-10-06 14:01 8.3K 
[TXT]Py_Pi_Day_2017.py2017-10-06 14:01 42K 
[TXT]Oraux_CentraleSupelec_PSI__Juin_2017.py2017-10-06 14:01 22K 
[TXT]Manual_implementation_of_some_hash_functions.py2017-10-06 14:01 65K 
[TXT]Benchmark_between_Python_and_Julia.py2017-10-06 14:01 25K 
[TXT]Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.py2017-10-06 14:01 35K 
[TXT]Short_study_of_the_Lempel-Ziv_complexity.py2017-10-06 14:02 20K 
[TXT]Simulated_annealing_in_Python.py2017-10-06 14:02 8.2K 
[TXT]Merge-k-sorted-lists.py2017-10-06 14:02 1.5K 
[   ]kullback.cpython-36m-x86_64-linux-gnu.so2017-10-28 10:52 54KSome configuration files for my use of the Python programming language
[   ]Generating_permutations_with_Python.ipynb2017-11-14 14:25 35K 
[   ]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
[TXT]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_Julia.ipynb2017-11-25 13:37 2.5M 
[   ]Runge-Kutta_methods_for_ODE_integration_in_Julia.jl2017-11-25 13:38 5.8K 
[   ]An_Identiconizer_generator_implementation_in_Python.ipynb2017-11-26 12:08 64K 
[TXT]An_Identiconizer_generator_implementation_in_Python.py2017-11-26 12:09 7.0K 
[   ]Runge-Kutta_methods_for_ODE_integration_in_OCaml.ipynb2017-11-26 16:46 598K 
[TXT]Runge-Kutta_methods_for_ODE_integration_in_OCaml.ml2017-11-26 16:46 12K 
[TXT]kullback.py2018-01-09 17:31 18K 
[   ]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 
[TXT]Introduction_aux_algorithmes_de_bandit__comme_UCB1_et_Thompson_Sampling.py2018-01-17 15:12 51K 
[   ]Exponential_Integral_Python.ipynb2018-01-24 11:03 546K 
[TXT]Exponential_Integral_Python.py2018-01-24 11:13 9.8K 
[   ]Solving_an_equation_and_the_Lambert_W_function.ipynb2018-01-31 15:03 406K 
[TXT]Solving_an_equation_and_the_Lambert_W_function.py2018-01-31 15:03 13K 
[   ]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
[   ]Verification_de_numeros_CB_RIB_NIRPP_IBAN.ipynb2018-02-02 15:28 35K 
[TXT]Verification_de_numeros_CB_RIB_NIRPP_IBAN.py2018-02-02 15:28 14K 
[TXT]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
[TXT]Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.html2018-03-09 11:30 415KBenchmark_of_the_SHA256_hash_function__Python_Cython_Numba
[TXT]Benchmark_between_Python_and_Julia.html2018-03-09 11:30 344KBenchmark_between_Python_and_Julia
[TXT]Exponential_Integral_Python.html2018-03-09 11:30 829KExponential_Integral_Python
[TXT]Generating_permutations_with_Python.html2018-03-09 11:30 317KGenerating_permutations_with_Python
[TXT]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
[TXT]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
[TXT]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
[TXT]Manual_implementation_of_some_hash_functions.html2018-03-09 11:30 523KManual_implementation_of_some_hash_functions
[TXT]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
[TXT]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
[TXT]Merge-k-sorted-lists.html2018-03-09 11:30 254KMerge-k-sorted-lists
[TXT]Obfuscated_code_or_piece_of_art.html2018-03-09 11:30 257KObfuscated_code_or_piece_of_art
[TXT]Profiling_in_a_Jupyter_notebook.html2018-03-09 11:30 277KProfiling_in_a_Jupyter_notebook
[TXT]Oraux_CentraleSupelec_PSI__Juin_2017.html2018-03-09 11:30 516KOraux_CentraleSupelec_PSI__Juin_2017
[TXT]Py_Pi_Day_2017.html2018-03-09 11:30 395KPy_Pi_Day_2017
[TXT]Runge-Kutta_methods_for_ODE_integration_in_OCaml.html2018-03-09 11:30 887KRunge-Kutta_methods_for_ODE_integration_in_OCaml
[TXT]Runge-Kutta_methods_for_ODE_integration_in_Julia.html2018-03-09 11:30 2.3MRunge-Kutta_methods_for_ODE_integration_in_Julia
[TXT]Runge-Kutta_methods_for_ODE_integration_in_Python.html2018-03-09 11:30 699KRunge-Kutta_methods_for_ODE_integration_in_Python
[TXT]Short_study_of_the_Lempel-Ziv_complexity.html2018-03-09 11:30 471KShort_study_of_the_Lempel-Ziv_complexity
[TXT]Solving_an_equation_and_the_Lambert_W_function.html2018-03-09 11:30 697KSolving_an_equation_and_the_Lambert_W_function
[TXT]Simulated_annealing_in_Python.html2018-03-09 11:30 820KSimulated_annealing_in_Python
[TXT]Tutorial_on_head_and_tail__bash_.html2018-03-09 11:30 262KTutorial on head and tail (bash)
[TXT]Tutorial on head and tail (bash).html2018-03-09 11:30 262KTutorial on head and tail (bash)
[TXT]Verification_de_numeros_CB_RIB_NIRPP_IBAN.html2018-03-09 11:30 324KVerification_de_numeros_CB_RIB_NIRPP_IBAN
[   ]Blurring_a_part_of_an_image_in_Python.ipynb2018-03-09 11:31 1.1M 
[TXT]Blurring_a_part_of_an_image_in_Python.py2018-04-22 15:49 2.6K 
[TXT]Blurring_a_part_of_an_image_in_Python.html2018-04-22 15:49 1.4MBlurring_a_part_of_an_image_in_Python
[   ]Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.ipynb2018-04-27 16:21 116K 
[TXT]Kullback_Leibler_divergences_in_native_Python__Cython_and_Numba.py2018-04-27 16:22 50K 
[TXT]Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.py2018-04-27 16:22 50K 
[TXT]Kullback-Leibler_divergences_in_native_Python__Cython_and_Numba.html2018-04-27 16:22 514KKullback-Leibler_divergences_in_native_Python__Cython_and_Numba
[   ]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.jl2018-04-30 18:56 5.0K 
[   ]Oraux_CentraleSupelec_PSI__Juin_2018.ipynb2018-06-10 01:28 299K 
[TXT]Oraux_CentraleSupelec_PSI__Juin_2018.html2018-06-10 01:32 613KOraux_CentraleSupelec_PSI__Juin_2018
[TXT]Oraux_CentraleSupelec_PSI__Juin_2018.py2018-06-10 01:32 28K 
[TXT]Testing_the_lolviz_Python_module.py2018-07-02 15:22 5.1K 
[TXT]Testing_the_lolviz_Python_module.html2018-07-02 15:22 391KTesting_the_lolviz_Python_module
[   ]Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.ipynb2018-07-03 14:46 90K 
[TXT]Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.py2018-07-03 14:47 9.1K 
[TXT]Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.py2018-07-13 15:33 59K 
[TXT]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_
[   ]Test_for_Binder__access_local_packages.ipynb2018-07-16 14:45 6.0K 
[TXT]Test_for_Binder__access_local_packages.html2018-07-16 14:46 253KTest_for_Binder__access_local_packages
[   ]LICENSE2018-09-18 11:22 1.1K 
[   ]LeconsInfos19.pdf2018-09-18 13:29 44K 
[   ]Manual_implementation_of_the_Mersenne_twister_PseudoRandom_Number_Generator__PRNG_.ipynb2018-11-22 14:23 2.9M 
[   ]A_short_study_of_Renyi_entropy.ipynb2018-11-22 14:49 103K 
[TXT]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 
[TXT]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
[   ]Generer_des_fausses_citations_latines_du_Roi_Loth.ipynb2018-12-04 11:00 32K 
[TXT]Generer_des_fausses_citations_latines_du_Roi_Loth.py2018-12-04 11:00 14K 
[TXT]Generer_des_fausses_citations_latines_du_Roi_Loth.html2018-12-04 11:00 301KGenerer_des_fausses_citations_latines_du_Roi_Loth
[   ]Algorithmes_pour_l_ecriture_inclusive.ipynb2018-12-26 21:46 9.6K 
[   ]DM_Images_debut.ipynb2019-01-08 17:54 1.6M 
[TXT]DM_Images_debut.py2019-01-08 17:55 4.8K 
[TXT]DM_Images_debut.html2019-01-08 17:55 1.8MDM_Images_debut
[   ]Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.ipynb2019-02-26 11:03 4.6K 
[TXT]Hierarchie_de_Grzegorczyk.tex2019-02-26 15:15 13K 
[   ]Hierarchie_de_Grzegorczyk.pdf2019-02-26 15:17 306K 
[   ]Efficient_sampling_from_a_Binomial_distribution.ipynb2019-02-28 15:26 214K 
[TXT]Efficient_sampling_from_a_Binomial_distribution.py2019-02-28 15:26 22K 
[TXT]Efficient_sampling_from_a_Binomial_distribution.html2019-02-28 15:26 501KEfficient_sampling_from_a_Binomial_distribution
[   ]ChaCha_PseudoRandom_number_generator.ipynb2019-03-04 13:59 7.4K 
[TXT]Oraux_CentraleSupelec_PSI__Juin_2019.py2019-05-24 10:45 28K 
[TXT]Algebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis.html2019-09-17 12:25 375KAlgebraic_integration_from_Ludovic_Sacchelli_s_PhD_thesis
[TXT]Algorithmes_pour_l_ecriture_inclusive.html2019-09-17 12:25 285KAlgorithmes_pour_l_ecriture_inclusive
[TXT]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
[TXT]An_Identiconizer_generator_implementation_in_Python.html2019-09-17 12:25 361KAn_Identiconizer_generator_implementation_in_Python
[TXT]Basic plotting and matrix operations (Octave).html2019-09-17 12:25 849KBasic plotting and matrix operations (Octave)
[TXT]Basic_plotting_and_matrix_operations__Octave_.html2019-09-17 12:25 849KBasic plotting and matrix operations (Octave)
[TXT]A_short_study_of_Renyi_entropy.html2019-09-17 12:25 387KA_short_study_of_Renyi_entropy
[   ]Cheat_sheet_for_Google_Colab.ipynb2020-09-14 15:39 26K 
[TXT]export.sh2020-09-14 15:40 720  
[TXT]french_inclusive.txt2020-09-28 14:51 712K 
[TXT]Ecriture inclusive.html2020-09-30 14:49 3.3MEcriture inclusive
[TXT]Ecriture_inclusive.html2020-09-30 14:49 3.3MEcriture inclusive
[TXT]A tiny regex challenge solved without another regex.html2020-10-13 12:42 584KA tiny regex challenge solved without another regex
[TXT]A_tiny_regex_challenge_solved_without_another_regex.html2020-10-13 12:42 584KA tiny regex challenge solved without another regex
[TXT]Tri tricolore.html2020-10-20 15:42 2.9MTri tricolore
[TXT]Tri_tricolore.html2020-10-20 15:42 2.9MTri tricolore
[   ]A tiny regex challenge solved without another regex.ipynb2021-01-26 20:40 13K 
[TXT]A tiny regex challenge solved without another regex.py2021-01-26 20:40 5.0K 
[   ]Basic plotting and matrix operations (Octave).ipynb2021-01-26 20:40 575K 
[   ]Basic plotting and matrix operations (Octave).m2021-01-26 20:40 1.2K 
[   ]Demonstration of numpy.polynomial.Polynomial and nice display with LaTeX and MathJax (python3).ipynb2021-01-26 20:40 21KSome configuration files for my use of the Python programming language
[   ]Ecriture inclusive.ipynb2021-01-26 20:40 2.6M 
[TXT]Ecriture inclusive.py2021-01-26 20:40 53K 
[   ]NetHack's functions Rne, Rn2 and Rnz in Python 3.ipynb2021-01-26 20:40 45K 
[TXT]NetHack's functions Rne, Rn2 and Rnz in Python 3.py2021-01-26 20:40 5.0K 
[   ]Simulations du jeu de carte Jap-Jap.ipynb2021-01-26 20:40 60K 
[TXT]Simulations du jeu de carte Jap-Jap.py2021-01-26 20:40 25K 
[   ]Tri tricolore.ipynb2021-01-26 20:40 2.4M 
[TXT]Tri tricolore.py2021-01-26 20:40 6.2K 
[   ]Tutorial on head and tail (bash).ipynb2021-01-26 20:40 12K 
[TXT]Tutorial on head and tail (bash).sh2021-01-26 20:40 606  
[   ]Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.ipynb2021-01-26 20:43 21K 
[TXT]Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.html2021-01-26 20:43 590KMini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021
[TXT]Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.py2021-01-26 20:43 12K 
[TXT]microKanren.py2021-02-02 21:49 4.3K 
[TXT]Février 2021 un mini challenge arithmético-algorithmique.html2021-02-02 23:41 634KFévrier 2021 un mini challenge arithmético-algorithmique
[TXT]Février 2021 un mini challenge arithmético-algorithmique.py2021-02-02 23:42 16K 
[   ]Prise de rdv automatique sur Doctolib.ipynb2021-02-09 17:14 11K 
[TXT]Prise de rdv automatique sur Doctolib.html2021-02-09 17:45 282KPrise de rdv automatique sur Doctolib
[TXT]Prise de rdv automatique sur Doctolib.py2021-02-09 17:45 4.4K 
[   ]Février 2021 un mini challenge arithmético-algorithmique.ipynb2021-02-09 20:00 38K 
[   ]Une exploration visuelle de l'algorithme du Simplexe en 3D avec Python.ipynb2021-02-09 22:11 163K 
[TXT]Une exploration visuelle de l'algorithme du Simplexe en 3D avec Python.html2021-02-09 22:11 423KUne exploration visuelle de l'algorithme du Simplexe en 3D avec Python
[   ]Une_exploration_visuelle_de_l_algorithme_du_Simplexe_en_3D_avec_Python.ipynb2021-02-10 13:02 170K 
[   ]Deboguer_du_code_Python_depuis_Notebook_Jupyter.ipynb2021-02-16 05:30 14K 
[   ]Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.ipynb2021-02-16 06:13 11KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[TXT]Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.slides.html2021-02-16 06:13 285KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[   ]Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml slides.pdf2021-02-16 06:16 218KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[   ]Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.pdf2021-02-16 06:18 102KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[   ]Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.ipynb2021-02-16 06:46 14K 
[TXT]Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.c2021-02-16 06:47 8.0K 
[TXT]Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.html2021-02-16 06:47 307KExample-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher
[   ]Demo_of_nbtutor_offline.ipynb2021-02-21 01:23 4.4K 
[   ]Démo of nbtutor offline.ipynb2021-02-21 01:23 4.4K 
[   ]Comparaison de tutormagic et nbtutor pour visualiser du code Python et C dans un notebook Jupyter.ipynb2021-02-21 02:11 289K 
[TXT]Comparaison de tutormagic et nbtutor pour visualiser du code Python et C dans un notebook Jupyter.py2021-02-21 02:11 20K 
[   ]Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.ipynb2021-02-21 03:40 293K 
[TXT]Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.html2021-02-21 03:42 576KComparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter
[   ]My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.ipynb2021-02-21 09:55 15K 
[   ]Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.ipynb2021-02-21 16:11 11KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[TXT]Deboguer_du_code_Python_depuis_Notebook_Jupyter.html2021-02-21 16:15 282KDeboguer_du_code_Python_depuis_Notebook_Jupyter
[TXT]Deboguer_du_code_Python_depuis_Notebook_Jupyter.py2021-02-21 16:15 1.4K 
[TXT]Demonstration of numpy.polynomial.Polynomial and nice display with LaTeX and MathJax (python3).html2021-02-21 16:15 307KSome configuration files for my use of the Python programming language
[TXT]Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.html2021-02-21 16:15 271KDemonstration_of_running_a_Jupyter_notebook_with_sudo_rights
[TXT]Demonstration_of_running_a_Jupyter_notebook_with_sudo_rights.py2021-02-21 16:15 1.4K 
[TXT]Demo_of_nbtutor_offline.html2021-02-21 16:15 269KDemo_of_nbtutor_offline
[TXT]Demo_of_RISE_for_slides_with_Jupyter_notebooks__Julia.html2021-02-21 16:15 280KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[TXT]Demo_of_RISE_for_slides_with_Jupyter_notebooks__OCaml.html2021-02-21 16:15 279KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[TXT]Demo_of_RISE_for_slides_with_Jupyter_notebooks__Python.html2021-02-21 16:15 280KCommon repository for Jupyter notebooks, open-source on GitHub. Readables on nbviewer.jupyter.org
[TXT]My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.html2021-02-21 16:16 287KMy_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn
[TXT]My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.py2021-02-21 16:16 2.2K 
[   ]Testing_the_lolviz_Python_module.ipynb2021-02-22 23:12 153K 
[   ]Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.ipynb2021-02-22 23:54 360K 
[TXT]Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.html2021-02-23 00:03 607KExtending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype
[   ]Demonstration_of_Pypi_package_OCaml_for_polyglot_notebook_02-2021.ipynb2021-02-23 06:42 427K 
[TXT]Demonstration_of_Pypi_package_OCaml_for_polyglot_notebook_02-2021.html2021-02-23 06:44 733KDemonstration_of_Pypi_package_OCaml_for_polyglot_notebook_02-2021
[TXT]requirements.txt2021-02-23 06:59 307  
[TXT]mocaml_history.ml2021-02-23 07:48 3.7K 
[   ]10_nuances_de_Fibonacci.ipynb2021-02-24 19:09 757K 
[   ]Trying_the_SnakeViz_Jupyter_extension_for_profiling__27-02-2021.ipynb2021-02-27 14:59 6.7K 
[TXT]Trying_the_SnakeViz_Jupyter_extension_for_profiling__27-02-2021.html2021-02-27 15:01 272KTrying_the_SnakeViz_Jupyter_extension_for_profiling__27-02-2021
[IMG]Using_Python_to_solve_Regexp_CrossWord_Puzzles_1.png2021-02-28 19:37 41K 
[IMG]Using_Python_to_solve_Regexp_CrossWord_Puzzles_2.png2021-02-28 19:37 6.5K 
[IMG]Using_Python_to_solve_Regexp_CrossWord_Puzzles_3.png2021-02-28 22:53 23K 
[TXT]test.html2021-02-28 23:04 10  
[TXT]Using_Python_to_solve_Regexp_CrossWord_Puzzles.html2021-03-10 12:07 474KUsing_Python_to_solve_Regexp_CrossWord_Puzzles
[   ]Using_Python_to_solve_Regexp_CrossWord_Puzzles.ipynb2021-03-10 12:07 110K 
[TXT]Using_Python_to_solve_Regexp_CrossWord_Puzzles.py2021-03-10 12:07 32K 
[   ]Combien_de_numeros_de_mobiles_francais_sont_des_nombres_premiers.ipynb2021-04-06 11:18 5.2K 
[TXT]Combien_de_numeros_de_mobiles_francais_sont_des_nombres_premiers.html2021-04-06 11:19 273KCombien_de_numeros_de_mobiles_francais_sont_des_nombres_premiers
[TXT]Oraux_CentraleSupelec_PSI__Juin_2019.html2021-10-25 15:16 874KOraux_CentraleSupelec_PSI__Juin_2019
[   ]Oraux_CentraleSupelec_PSI__Juin_2019.ipynb2021-10-25 15:20 530K 
[   ]Resoudre_World_of_Words_avec_Python3.ipynb2022-03-06 14:09 221K 
[TXT]Coding_and_Decoding_Lempel-Ziv-Welch_in_Python.py2022-03-25 12:14 2.5K 
[   ]Coding_and_Decoding_Lempel-Ziv-Welch_in_Python.ipynb2022-03-25 12:27 23K 
# [Jupyter Notebooks](http://jupyter.org/) :notebook: by [Naereen @ GitHub](https://naereen.github.io/)

This repository hosts *a lot of* [Jupyter Notebooks](http://jupyter.org/), covering various subjects.
Everything is open-sourced under [the MIT License](https://lbesson.mit-license.org/), you can use any of these notebooks for your own teaching activities if you want. Please [open an issue](https://github.com/Naereen/notebooks/issues/new), or [ask me anything](https://github.com/Naereen/ama) or [drop an email](https://besson.link/callme.en.html) if you have any questions, suggestions, or more.

*Which languages?* Half of the notebooks here are in :gb: English, and the other half in :fr: French (surtout pour *l'agrégation de mathématiques option informatique*, dans ce dossier [`agreg/`](agreg/)), and most use [the Python language](https://www.Python.org/), or [OCaml](https://OCaml.org), and a few notebooks use other languages like Julia, Rust, Java or even Bash, C and Octave!

## How to read or use these notebooks?
You can view this repository on [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/) to read notebooks statically, or read them directly from GitHub.

You can also launch an interactive environment to play with the code by yourself, using one of these platforms:
- MyBinder should work fine even for OCaml notebooks, but it's quite slow. It's fully open-source, and reliable: [![MyBinder v2](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Naereen/notebooks/master)
- Google Colab should work only for Python notebooks, but it's blazing fast to load. It's not open-source and requires to use Google's servers: [![Google Colab: Launch](https://img.shields.io/badge/Google%20Colab-Launch-blue.svg)](https://colab.research.google.com/github/Naereen/notebooks/blob/master/)

- **New!** In Feb'21, [I have installed](https://github.com/Naereen/Mon-utilisation-de-Basthon/) the amazing [Basthon notebook](https://basthon.fr/about.html) to my website, at <http://notebook.besson.link/>, and you can use it with any of the notebooks available in the repository, for instance <https://besson.link/Basthon/notebook/?from=../../publis/notebooks/Py_Pi_Day_2017.ipynb> for [`Py_Pi_Day_2017.ipynb`](Py_Pi_Day_2017.ipynb), because this folder is synced on my website at <https://besson.link/publis/notebooks/>. Please [open an issue](https://github.com/Naereen/notebooks/issues/new) if this doesn't work!

## My use of notebooks - short story since 2015

- At the beginning (as early as end of 2015!), 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. So they were baby notebooks :baby_bottle:... Since then, I did *a lot of experiments*, on all the most important kernels (Python, Julia, but also less standard ones like OCaml, Rust, Java, C, Bash, etc), all the most exciting notebook extensions, and output formats (PDF, script, static HTML, slides, etc). I've kept learning and discovering more [awesomeness of the Jupyter environment](https://github.com/markusschanta/awesome-jupyter), and it never stops to amaze me :sparkles:!
- In the last 5 years (2016-2021), I've used Jupyter notebooks intensively, to teach algorithmics, programming, and (not so theoretical) computer science in general, mainly in :fr: French. I wrote notebooks to teach [introduction to Java in 2020](https://perso.crans.org/besson/teach/INF1_L1_Rennes1_2020-21/), [advanced algorithms using Python in 2019](https://github.com/Naereen/ALGO1-Info1-2019), and a lot for experimenting during [my PhD thesis](https://perso.crans.org/besson/phd/).
- :fr: J'ai aussi corrigé *tous* les textes d'annales de modélisation, en option informatique, pour le concours national de l'agrégation de maths, en utilisant OCaml ou des fois Python ! Ce sont les seuls corrigés de ce type disponibles sur tous les Internets (j'ai cherché partout !), et ils sont dans ce dossier : [`agreg/`](agreg/). [Je compte]() déplacer ça dans un dossier à part, et bien les nettoyer et mettre à jour, en 2021.
- I love the Jupyter environment, from the old [IPython command line](https://ipython.org/) to the recent [awesome](https://github.com/mauhai/awesome-jupyterlab) [Jupyter Lab](https://github.com/jupyterlab/jupyterlab). If you want to discover amazing things, check out: [RISE for live slides in a notebook](https://rise.readthedocs.io/), [lolviz](https://github.com/parrt/lolviz/) and [rcviz](https://github.com/DamnedFacts/rcviz) and [tutormagic](https://github.com/kikocorreoso/tutormagic/) for nice data structures visualizations in a notebook.

- In the future, **I plan to mostly teach using Jupyter notebooks**, using either the regular Python kernel, the [OCaml-jupyter](https://github.com/akabe/ocaml-jupyter/) kernel for [OCaml](https://ocaml.org) (and also [IJava](https://github.com/SpencerPark/IJava) for Java, [this one for C](https://github.com/brendan-rius/jupyter-c-kernel), and more if needed). RISE slides embed a chalk-board mode, more limited in comparison to the amazing [TableauNoir](https://tableaunoir.github.io/).

## A partial list of notebooks in this repository

I'm trying to maintain here a list of the notebooks stored in this repository, inspired by the amazing [pytudes](https://github.com/norvig/pytudes) by [Peter Norvig](https://github.com/norvig/).
The links open [nbviewer](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/)), and the links ([on GitHub?](https://github.com/Naereen/notebooks/)) open the notebook to be viewed directly in GitHub (it should work for almost all of them).

### :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)).

- :fr: [Ce notebook présente des approches simples pour générer un dictionnaire des mots français adaptés à l'écriture inclusive](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Ecriture%20inclusive.ipynb), comme beau/belle -> beau·elle, professeur/professeure -> professeur·e, il/elle -> iel/ielle etc ([on GitHub?](Ecriture%20inclusive.ipynb)). [Ici ce trouve le dictionnaire généré (contenant environ 26 000 mots différents)](french_inclusive.txt). ~~Work in progress?~~ (je ne terminerai pas, c'est trop compliqué de faire ça parfaitement)

- :fr: En s'inspirant de [cet article](https://kalebujordan.com/make-your-own-plagiarism-detector-in-python/) (décembre 2020), [j'expérimente dans ce notebook avec scikit-learn pour détecter les similarités et les risques de plagiat dans des projets étudiants écrits en Java](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.ipynb) (mais l'approche est indépendante du langage !) ([on GitHub?](My_own_tiny_similarity_and_plagiarism_detector_in_Python_scikit-learn.ipynb))

- [This long but easy to follow notebook explains how to solve](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Using_Python_to_solve_Regexp_CrossWord_Puzzles.ipynb) the regular expression cross-words from [this website](https://regexcrossword.com/challenges/), as I was struggling to solve [this difficult one (Volapük Lul)](https://regexcrossword.com/challenges/volapuk/puzzles/5) ([on GitHub?](Using_Python_to_solve_Regexp_CrossWord_Puzzles.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)).

- :fr: [Ce notebook en français est un petit tutoriel pour apprendre à résoudre des problèmes/programmes linéaires en Python avec SciPy](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.ipynb), pour le cours [ALGO2](http://people.irisa.fr/Francois.Schwarzentruber/algo2/) à [l'ENS Rennes](http://www.dit.ens-rennes.fr/) en janvier 2021 ([on GitHub?](Mini_tutoriel_pour_la_resolution_de_programmes_lineaires_avec_Python__ENS_Rennes_2021.ipynb)).

- :fr: [Ce notebook en français montre une expérimentation de visualisation interactive de l'algorithme du Simplexe](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Une_exploration_visuelle_de_l_algorithme_du_Simplexe_en_3D_avec_Python.ipynb), pour le cours [ALGO2](http://people.irisa.fr/Francois.Schwarzentruber/algo2/) à [l'ENS Rennes](http://www.dit.ens-rennes.fr/) en février 2021 ([on GitHub?](Une_exploration_visuelle_de_l_algorithme_du_Simplexe_en_3D_avec_Python.ipynb)).

- :fr: [Ce petit notebook en français présente un challenge](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/F%C3%A9vrier%202021%20un%20mini%20challenge%20arithm%C3%A9tico-algorithmique.ipynb) : « Comptez le nombre de mois de février répondant à ce critère (je n'ai pas trouvé de nom précis), depuis l'année de création de l'ENS Rennes (1994, enfin pour Cachan antenne Bretagne) jusqu'à 2077 (1994 et 2077 inclus). ». ([on GitHub?](F%C3%A9vrier%202021%20un%20mini%20challenge%20arithm%C3%A9tico-algorithmique.ipynb)).

- :fr: :bug:  [Ce petit notebook en français montre comment déboguer du code Python depuis Jupyter](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Deboguer_du_code_Python_depuis_Notebook_Jupyter.ipynb) ([on GitHub?](Deboguer_du_code_Python_depuis_Notebook_Jupyter.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)

#### 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.

- 🔍 ✨ I first tried the [`lolviz`](https://github.com/parrt/lolviz/) [module in 2017](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Testing_the_lolviz_Python_module.ipynb) ([on GitHub?](Testing_the_lolviz_Python_module.ipynb)), and then again in 2021, to [improve it](https://github.com/parrt/lolviz/issues/27), [with a unified display function that chooses the best one based on the datatype](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.ipynb) ([on GitHub?](Extending_lolviz_with_a_unified_display_function_that_chooses_the_best_one_based_on_the_datatype.ipynb)).

### 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:.

- :fr: Cette comparaison des deux extensions [`tutormagic`](https://github.com/kikocorreoso/tutormagic/) et [`nbtutor`](https://github.com/lgpage/nbtutor/) dans [ce notebook (20/02/2021)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.ipynb) ([on GitHub?](Comparaison_de_tutormagic_et_nbtutor_pour_visualiser_du_code_Python_et_C_dans_un_notebook_Jupyter.ipynb))

- :negative_squared_cross_mark: Demonstration of using the [`nbtutor`](https://github.com/lgpage/nbtutor/) extension offline [this other tiny notebook (20/02/2021)](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Demo_of_nbtutor_offline.ipynb) ([on GitHub?](Demo_of_nbtutor_offline.ipynb)) - Failure! TODO:

### With the [C language](https://github.com/brendan-rius/jupyter-c-kernel)

- [An example notebook in C language, showing two approaches to match a regular expression from a large text](https://nbviewer.jupyter.org/github/Naereen/notebooks/blob/master/Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.ipynb) ([on GitHub?](Example-of-a-Jupyter-notebook-in-C_Regular-Expression-Matcher.ipynb))

### 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.

You can also launch an interactive environment to play with the code by yourself, using one of these platforms:
- MyBinder should work fine even for OCaml notebooks, but it's quite slow. It's fully open-source, and reliable: [![MyBinder v2](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Naereen/notebooks/master)
- Google Colab should work only for Python notebooks, but it's blazing fast to load. It's not open-source and requires to use Google's servers: [![Google Colab: Launch](https://img.shields.io/badge/Google%20Colab-Launch-blue.svg)](https://colab.research.google.com/github/Naereen/notebooks/blob/master/)

- **New!** In Feb'21, [I have installed](https://github.com/Naereen/Mon-utilisation-de-Basthon/) the amazing [Basthon notebook](https://basthon.fr/about.html) to my website, at <http://notebook.besson.link/>, and you can use it with any of the notebooks available in the repository, for instance <https://besson.link/Basthon/notebook/?from=../../publis/notebooks/Py_Pi_Day_2017.ipynb> for [`Py_Pi_Day_2017.ipynb`](Py_Pi_Day_2017.ipynb), because this folder is synced on my website at <https://besson.link/publis/notebooks/>. Please [open an issue](https://github.com/Naereen/notebooks/issues/new) if this doesn't work!

> *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).

> :warning: I've not updated this section since 2016.

### 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).
> - :fr: Plus d'informations sur [Basthon](https://notebook.basthon.fr/) : <https://basthon.fr/about.html>

## :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-21.

[![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)
[![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/)