Zulip Chat Archive

Stream: Is there code for X?

Topic: Differences of powers


Martin Dvořák (Sep 11 2023 at 17:15):

Do we have this thing in Mathlib?
differences.png
You will probably recognize this pattern (which works for any exponent) faster from a picture.

Jireh Loreaux (Sep 11 2023 at 17:19):

Are you asking if we have discrete calculus?

Martin Dvořák (Sep 11 2023 at 17:20):

I had no idea it had a name!

Jireh Loreaux (Sep 11 2023 at 17:21):

(Maybe I got the name wrong, hold on)

Martin Dvořák (Sep 11 2023 at 17:23):

BTW this code generated those numbers (no proof included):

def apply_repeatedly {α : Type} (op : α  α) (x : α) : Nat  α
| 0   => x
| n+1 => apply_repeatedly op (op x) n

def diffs : List Nat  List Nat
| [ ]         => []
| [ _ ]       => []
| a :: b :: l => (b-a) :: diffs (b :: l)

def magic (n : Nat) : List Nat :=
  apply_repeatedly diffs (List.map (· ^ n) (List.range 10)) n

#eval magic 2
#eval magic 3
#eval magic 4
#eval magic 5
#eval magic 6

Jireh Loreaux (Sep 11 2023 at 17:24):

A nice introduction to this is here: https://homepages.math.uic.edu/~kauffman/DCalc.pdf, and it assumes almost no background knowledge. The wikipedia page can get a bit heady in places.

Yaël Dillies (Sep 11 2023 at 17:25):

I have some code in a lost branch of mathlib. Tell me what you want more precisely and I might have it.

Martin Dvořák (Sep 11 2023 at 17:26):

Do we have a proof that the nth column is n! all the way?

Yaël Dillies (Sep 11 2023 at 17:26):

Oh that's easy.

Yaël Dillies (Sep 11 2023 at 17:28):

I have the result that the leading coeff of the discrete difference of a polynomial is its leading coeff times its degree. Then you induct and tada.

Martin Dvořák (Sep 11 2023 at 17:33):

Perfect! May I get a link to your result? I would love to do the corollary with my students by the end of our course.

Alex Kontorovich (Sep 11 2023 at 18:01):

Jireh Loreaux said:

A nice introduction to this is here: https://homepages.math.uic.edu/~kauffman/DCalc.pdf, and it assumes almost no background knowledge. The wikipedia page can get a bit heady in places.

I learned this from Conway, who called it "Bernouilli calculus": https://twitter.com/AlexKontorovich/status/1075779916480811010?s=20 (The joke of course is that Bernouilli was doing the continuous calculus, too!...)


Last updated: Dec 20 2023 at 11:08 UTC