Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    N

    Nicolas Rougier

    labri.fr · Personal blog · on HN since 2011

    Nicolas Rougier, a researcher at a French computing lab, writes free books and tutorials on Python, NumPy, Matplotlib, and scientific visualization.

    Visit blogHN submissions
    ProgrammingData & VisualizationScience
    What HN says

    HN commenters praise his open books, especially From Python to Numpy, calling it the best NumPy tutorial they have read, and thank him for sharing.

    Stats for nerds
    29HN people shared it
    14linked in comments
    1.1Kstory points
    Sep 2024last shared
    2011people per year2024

    Top posts on HN

    1. 1
      From Python to Numpy
      13 people · 512 points · first shared 2016 · 73 comments on HN
    2. 2
      Get things done with Emacs
      2 people · 298 points · first shared 2021 · 80 comments on HN
    3. 3
      Python and OpenGL for Scientific Visualization
      5 people · 273 points · first shared 2018 · 24 comments on HN
    4. 4
      Matplotlib tutorial
      3 people · 2 points · first shared 2015 · Discussion on HN
    5. 5
      Matplotlib tutorial
      1 person · 2 points · first shared 2016 · Discussion on HN
    6. 6
      Stunning figures from newly released book on matplotlib (open access)
      1 person · 2 points · first shared 2021 · 1 comments on HN
    7. 7
      RecTutorial.pdf
      1 person · first shared 2015
    8. 8
      Index
      1 person · first shared 2011
    9. 9
      GTD.css
      1 person · first shared 2022
    10. 10
      Trees.pdf
      1 person · first shared 2022

    What HN people wrote when they linked it

    • goldenkeyJul 2022

      This work is subtly related to chaos theory.

      The nth coefficient of the ith Mandelbrot polynomial lemniscate [3] is equal to the number of possible binary trees with n nodes of height i or less. This is because z -> z^2 + c reflects coefficients recursively produced by repeated applications of the binomial theorem.

      When n becomes <= i, the nth coefficient stabilizes, converging to the nth Catalan number, which is the number of possible binary trees with n nodes. The nth Catalan number is also the number of triangulations of an n+2-gon.

      https://en.m.wikipedia.org/wiki/Catalan_number#Applications_in_combinatorics

      Now, there is a 1-to-1 bijective mapping between binary trees of height n and node count i, and n+2 sided polygon triangulations with i segments.

      https://www.r-bloggers.com/2015/07/catalan-numbers-fortriangulationsgamblers-ruinbinary/

      In fact, the same associahedron in "Flipping until you are lost" is mentioned here:
      https://www.researchgate.net/figure/The-bijection-between-binary-plane-trees-and-triangulations-of-a-polygon-as_fig1_225917464

      What is the significance of all of this? There is currently no closed form approximation for these numbers. As simple as it might sound, we have no closed form for the number of binary trees with i nodes of height <= n. If we did, we could approximate the Mandelbrot and it would unlock new frontiers of understanding chaos theory.

      Philippe Flajolet, a now-deceased titan of analytic combinatorics [2] wrote some papers on the…

    • dansoSep 2016

      I actually have no idea about that. I don't think there's an equivalent to R's base graphics, so that would seem to make matplotlib the closest thing to a standard -- seaborn [0], which I've seen used a lot lately for more advanced dataviz, lives atop it, but it's also relatively new.

      People seem to have conflicted feelings about matplotlib, maybe because of its origin in MATLAB? Not that Matlab itself is bad, but I think the decision to make matplotlib's API comfortable for MATLAB users seems to cause confusion to contemporary users, even before the usual 2.x vs 3.x issues (matplotlib ported to 3.x a few years ago but many users still write Python in the 2.x style.)

      Anecdotally, I feel like I see advice like "Just use plotly" more than I see recommendations to actually learn matplotlib. I actually gave up on matplotlib until I stumbled upon this comprehensive tutorial, which covers the basics and many elaborate use cases. If there's a book that does it better, I haven't heard about it:

      http://www.labri.fr/perso/nrougier/teaching/matplotlib/

      The matplotlib site itself is chockful of well-documented examples, but some of them seem to be significantly more verbose than they need to be. My impression is that the library is stable/ubiquitous enough that there isn't a big movement to overhaul things. Last time I looked at the API changes for v2.0 [1] (1.5.3 is stable), most of the changes had to do with default styles and stylesheets, which is non-trivial given the number of…

    • cs702Aug 2017

      If you really care about extracting every possible ounce of performance out of Python's scientific stack, which relies extensively on Numpy, the best practical guide I have found for doing that is "From Python to Numpy," by Nicolas P. Rougier of Inria: https://www.labri.fr/perso/nrougier/from-python-to-numpy/

      Here's a typical example of the kinds of optimizations this guide teaches you, in this case by avoiding the creation of temporary copies of Numpy arrays in memory:

      # Create two int arrays, each filled with with one billion 1's.
      X = np.ones(1000000000, dtype=np.int)
      Y = np.ones(1000000000, dtype=np.int)

      # Add 2 * Y to X, element by element:

      # Slowest
      %time X = X + 2.0 * Y
      100 loops, best of 3: 3.61 ms per loop

      # A bit faster
      %time X = X + 2 * Y
      100 loops, best of 3: 3.47 ms per loop

      # Much faster
      %time X += 2 * Y
      100 loops, best of 3: 2.79 ms per loop

      # Fastest
      %time np.add(X, Y, out=X); np.add(X, Y, out=X)
      100 loops, best of 3: 1.57 ms per loop

      That's a 2.3x speed improvement (from 3.61 ms to 1.57 ms) on a simple vector operation (your mileage will vary!).[1] This only scratches the surface. The guide goes into quite a bit of explicit detail about how Numpy arrays are constructed and stored in memory and always explains the underlying reasons why some operations are faster than others. In addition, the guide has a section titled "Beyond Numpy" that points to even more ways of improving performance, e.g., by using Cython,…

    • danblickJun 2015

      The article isn't loading for me right now, but I thought I'd mention co-inductive types and how they relate to "interaction".

      In Coq, co-inductive types are used to model infinite objects like (never-ending) streams or (non-terminating) program executions.

      Inductive List (A: Set): Set :=
      | Nil: List A
      | Cons : A -> List A -> List A.

      CoInductive Stream (A: Set): Set :=
      | SCons: A -> Stream A -> Stream A.

      Fixpoint len {A: Set} (x: List A): nat :=
      match x with
      | Nil => 0
      | Cons _ y => 1 + len y
      end.

      CoFixpoint ones : Stream nat :=
      SCons nat 1 ones.

      If you want to talk about how systems interact with the world, you can use bisimilarity relations to prove "these two systems interact with the world in the same way".

      You can also use co-inductive types to embed the temporal logic of actions (TLA) in Coq; TLA is the language Leslie Lamport works with for "Specifying Systems".

      * http://www.labri.fr/perso/casteran/RecTutorial.pdf

      * http://www.amazon.com/Specifying-Systems-Language-Hardware-Engineers/dp/032114306X

      * http://en.wikipedia.org/wiki/Bisimulation

    • simonhSep 2015

      Modern computer operating systems won't let you arbitrarily switch pixels on the screen on or off, so you'd need to either write a program that uses a GUI library to create a window, controls, etc, or generate an image file you can open in a viewer.

      For Python, matplotlib(1) will let you generate plots and graphs, including simple x/y graphs, or you could use the built-in TkInter(2) library to do a simple GUI with a drawing canvas.

      (1)http://www.labri.fr/perso/nrougier/teaching/matplotlib/
      (2) http://www.python-course.eu/tkinter_canvas.php

    • jszymborskiSep 2024

      Love Mr. Rougier's open books. I supported this one while it was in development and I wasn't disappointment by the final product.

      I've long awaited for him to finish "Python & OpenGL for Scientific Visualization" [0] but I'll take this in the mean time :P

      [0] https://www.labri.fr/perso/nrougier/python-opengl/#python-opengl-for-scientific-visualization

    Related

    Jake VanderPlasjakevdp.github.io140 people

    Python Data Science Handbook

    Jake VanderPlas
    Personal · last shared 2026
    Dan Baderdbader.org26 people

    Interfacing Python and C: Advanced “ctypes” Features

    Dan Bader
    Personal · last shared 2022
    Philippe Gaultiergaultier.github.io23 people

    You've just inherited a legacy C++ codebase, now what?

    Philippe Gaultier
    Personal · last shared 2026
    David Robinsonvarianceexplained.org47 people

    One Year as a Data Scientist at Stack Overflow

    David Robinson
    Personal · last shared 2026
    Steven Wittensacko.net287 people

    TermKit - a graphical terminal replacement

    Steven Wittens
    Personal · last shared 2026
    Chris Rackauckasstochasticlifestyle.com39 people

    Some Insights from a Julia Developer

    Chris Rackauckas
    Personal · last shared 2026
    Alain Galvanalain.xyz19 people

    Ray Tracing Denoising

    Alain Galvan
    Personal · last shared 2025
    Joel Grusjoelgrus.com58 people

    Hacking Hacker News

    Joel Grus
    Personal · last shared 2026