
A Tribute to Euler (2008) [video] - rfreytag
https://www.youtube.com/watch?v=qtkX18dU2_U
======
jules
Euler was a master of generating functions. Here is a little taste. Start with
a Haskell data type:

    
    
       data Tree x = Leaf | Node x (Tree x) (Tree x)
    

The question is how many different Trees of size n are there, where n is the
number of x values in the tree.

    
    
      Size 0: Leaf
      Size 1: Node x Leaf Leaf
      Size 2: Node x (Node x Leaf Leaf) Leaf, Node Leaf (Node x Leaf Leaf)
    

It turns out this sequence goes 1,1,2,5,14,42,...

Now we do black magic: we take the Tree x = Leaf | Node x (Tree x) (Tree x)
equation and replace Tree x with a function T(x), replace each constructor
(Leaf or Node) with the number 1, and replace | with +. We get:

    
    
      T(x) = 1 + 1*x*T(x)*T(x)
    

Simplifying:

    
    
      T(x) = 1 + xT(x)^2
    

We can solve that:

    
    
      T(x) = (1 - sqrt(1 - 4x))/2x
    

Now we do a series expansion of T:

    
    
      T(x) = 1 + 1x + 2x^2 + 5x^3 + 14x^4 + 42x^5 + ...
    

[https://www.wolframalpha.com/input/?i=series+(1+-+sqrt(1+-+4...](https://www.wolframalpha.com/input/?i=series+\(1+-+sqrt\(1+-+4+x\)\)%2F\(2+x\))

Magic!

You can try it yourself with:

    
    
        data List x = Leaf | Node x (List x)
        data Tree2 x = Leaf | Single x | Node x (Tree2 x) (Tree2 x)
    

And if you're really adventurous, try:

    
    
        data Tree3 x = Node x (List (Tree3 x))
        data Tree4 x y = Leaf y | Node x (Tree4 x y) (Tree4 x y)
        data Tree5 x = Tree2 (Tree2 x)
        data Foo x = Leaf x | Node (Foo x)

~~~
bmer
If you are interested in learning more about this:
[https://www.math.upenn.edu/~wilf/DownldGF.html](https://www.math.upenn.edu/~wilf/DownldGF.html)

~~~
jules
There's also
[http://algo.inria.fr/flajolet/Publications/book.pdf](http://algo.inria.fr/flajolet/Publications/book.pdf).
The first chapter of this book is more or less equivalent to
generatingfunctionology, but has a more modern flavour.

~~~
bmer
Wow, nice!

------
Koshkin
Euler was a genius, and he wrote a bunch of calculus textbooks. I wonder if
they are still worth studying - other than out of historical interest, that
is.

~~~
monochromatic
Historical interest is fine, but if you just want to learn math I wouldn’t
bother.

~~~
synthmeat
You say this, but I personally tried many approaches to math, and historical
approach is the only one that seems to keep my attention. It feels much more
like an adventure in time, space and mind like this. Currently looking forward
to Liber Abaci sometime in 2019.

It definitely is a roundabout and non-pragmatic way, I agree, but I find it
rewarding enough to keep me going. Unrelated, I think children's math
education could benefit a lot from this kind of approach.

~~~
bmer
There are quite a few books that take this approach actually. One of my
favourites:
[https://www.springer.com/gp/book/9781441960528](https://www.springer.com/gp/book/9781441960528)

