News for hackers. Stuff that matters.
Re:Abusing the algebra of algebraic data types – why does th... by nequo on Monday October 10, 2022 @03:25PM (#33155450)
The quote in the footnote[1] says that `f` means something different on the two sides of the equation ∂f/∂x = ∂f/∂u ∂u/∂x + ∂f/∂v ∂v/∂x.

Why is this true? I think about ∂/∂x, ∂/∂u, and ∂/∂v as higher-order functions that take the same `f` as their argument. What is wrong about this thinking?

[1] https://groups.csail.mit.edu/mac/users/gjs/6946/sicm-html/bo...

Edit: I'm guessing the footnote's reasoning is that on the left hand side, `f` is thought of as `f(x, y)`, and on the right as `f(u(x, y), v(x, y))`.

Re:Abusing the algebra of algebraic data types – why does th... by dannymi on Monday October 10, 2022 @08:28PM (#33158029)
Indeed the signature of the function on the lhs is f(x) and of the one on the rhs is f(u,v).

On the rhs, it very much is not lambda x: f(u(x), v(x)) that the differential operator ∂/∂u (or ∂/∂v) is applied on—because the former would be a function of x.

(I use only x rather than (x,y) for simplicity so you can see where a big problem would lie)

Be aware that the notation in ∂f/∂x = ∂f/∂u ∂u/∂x + ∂f/∂v ∂v/∂x is already very simplified and the actual whole thing would be (in modern notation, as opposed to the one used by SICP):

∂/∂x f0(x) = ∂/∂u f(u(x),v(x)) ∂/∂x u(x) + ∂/∂v f(u,v) ∂/∂x v(x)

Where (as is usual) the (...) denotes function calls, and the ∂/∂x f0 makes a new function, here of x. Note that the function call is done on that new function (this order of precedence is the usual in mathematics)

Also, f0(x) = f(u(x),v(x))

Understanding what exactly is going on where in here is already the basis for fluid dynamics.