News for hackers. Stuff that matters.
Re:Calculus for Beginners and Artists (2003) by lewisjoe on Sunday July 14, 2019 @11:22AM (#20433891)
Came across this just when I was looking to deep dive into calculus, typed lambda calculus, differentiation, etc. I somehow have a hunch learning these, will help me down my road on language design and implementing compilers.

Only midway, but hands down this is the best material I came across on the subject. As light-hearted as much as detailed.

Update: Thank you, all. I guess the dots would never connect down my road. But I'm midway and the topic's still interesting enough for me to keep going.

Re:Calculus for Beginners and Artists (2003) by jcranmer on Sunday July 14, 2019 @04:26PM (#20435767)
As a compiler developer:

Integral and differential calculus is not useful at all [1]. Compilers are not very computation-heavy, and where they do require grinding through math, the interesting problems are discrete math rather than continuous variable problems, which means that integral and differential calculus very rarely offer insights.

The math you usually want is algebra. Even then, the elementary algebra you learned in high school (or earlier) is usually sufficient. More complex domains in math are usually used for theoretical analysis and are less common in practice. Many dataflow optimizations can be described as monotonic functions over a semilattice, but they are rarely implemented as such. Type systems in functional languages can be understood more richly as applied category theory. Linear algebra is useful when multidimensional loop nests come into play.

[1] Unless maybe you're building a neural network compiler.

Re:Calculus for Beginners and Artists (2003) by mcncm on Sunday July 14, 2019 @11:44AM (#20434013)
Just out of curiosity, why do you need to know differential calculus to write a compiler, and what does it have to do with lambda calculus? Learning it is a great thing to do, and it will certainly help you in other ways. But that kind of programming usually has little in common with the "mathematical analysis" kind of calculus (unless you're specifically interested in differentiable programming, which is actually kind of big these days). Anyway, happy studies!
Re:Calculus for Beginners and Artists (2003) by lewisjoe on Sunday July 14, 2019 @12:18PM (#20434239)
Oh, I have this bad habit of going down the rabbit hole of fundamentals if I feel I lack the basics of a concept. While I still haven't grasped the need for calculus in language design, I've come across pieces on how Lisp is based on lambda calculus vs Haskell based on typed lambda calculus. Also, that any problem that can be solved with turing machine, can be solved by lambda calculus as well. While not much about compilers, I guess it will solidify my understanding of language designs?

I'm not sure. I'll rather learn and hope the dots will connect later than ignore the subject altogether.

Re:Calculus for Beginners and Artists (2003) by mcncm on Sunday July 14, 2019 @12:27PM (#20434296)
I guess... Well, maybe I'm misunderstanding what you're saying, but I just want to be clear that you know that the branch of math most people call "calculus" is almost completely unrelated to the branches of math called "lambda calculus", and "typed lambda calculus." The former, which this link is about, has very little to do with language design. In fact, there are all different kinds of math called "X calculus" and "calculus of Y", each of which has nothing to do with the other.

Just "calculus" is short for "differential and integral calculus," which is about the local behavior of functions and the measure of objects in continuous spaces. Many people study this in high school (and earlier), since it's the underlying mathematical technology for much of the physical sciences. "Lambda calculus" is a logical system for manipulating symbols representing functions, and is indeed equivalent to Turing's symbol-manipulation system. So they both have to do with functions, but that's about where the similarity ends!

I hope I'm not coming off as brusque or anything, I just don't want you to spend loads of time on something that isn't what you think it is! That said, lots of programmers are surprisingly weak in (differential/integral) calculus, and could use a good dose of it anyway :)

Re:Calculus for Beginners and Artists (2003) by p0llard on Sunday July 14, 2019 @12:21PM (#20434265)
Just to clarify, you do realise that lambda calculus is an entirely different field to the calculus of mathematical analysis? They really have very little in common apart from the name.

Sorry if you already knew this, but it seemed like you were making a connection that wasn't there.

Re:Calculus for Beginners and Artists (2003) by wool_gather on Sunday July 14, 2019 @12:22PM (#20434270)
Let's clarify here: "Calculus"[0] and the lambda calculus have almost nothing to do with one another. They just share a word in their name, like the Department of Mathematics and the Fire Department. There are several different things called "the X calculus".

[0]:Could be called "numerical calculus" or "calculus of integration and differentiation", perhaps.

Re:Calculus for Beginners and Artists (2003) by JoelMcCracken on Sunday July 14, 2019 @12:36PM (#20434336)
A while back I was trying to under why some things are called algebras and others calculus. The answer I got is that the term calculus is related to the introduction/reduction of variables or symbols, whereas an algebra is manipulation of existing symbols.
Re:Calculus for Beginners and Artists (2003) by mruts on Sunday July 14, 2019 @01:37PM (#20434655)
I always thought it related to continuous variables and the highly useful concept of the infinitesimal. But maybe that definition works as well.
Re:Calculus for Beginners and Artists (2003) by User23 on Sunday July 14, 2019 @03:30PM (#20435420)
I thought it was just yet another historical and linguistic oddity in English.
Re:Calculus for Beginners and Artists (2003) by mruts on Sunday July 14, 2019 @04:07PM (#20435655)
Calculus means "stone" in Latin. I suspect the relationship between stones and counting is why we use it so much (though I'm not an expert on how/why Romans used stones).
Re:Calculus for Beginners and Artists (2003) by User23 on Sunday July 14, 2019 @03:29PM (#20435416)
Good clarification, but I wouldn't say almost nothing. All are formal symbolic reasoning techniques.

For example, The predicate calculus is invaluable for writing correct programs with mind-bogglingly large input domains, such as the set of all C++ programs.

Re:Calculus for Beginners and Artists (2003) by mlevental on Sunday July 14, 2019 @08:09PM (#20437123)
historically they were called the differential calculus and the integral calculus
Re:Calculus for Beginners and Artists (2003) by mruts on Sunday July 14, 2019 @12:20PM (#20434257)
Lambda calculus nor regular calculus are going to help you write a compiler. And certainly regular calculus isn’t going to help you design a language...
Re:Calculus for Beginners and Artists (2003) by jnbiche on Sunday July 14, 2019 @04:49PM (#20435907)
If you're writing a compiler for a functional language, lambda calculus is quite useful, and even necessary is some cases (understanding typed lambda calculus is pretty fundamental to statically typed functional languages from an implementation point of view).