3 ms·
> I really don’t see the connection with programming It may just be the stupid way my brain is wired. When I think about calculus I can’t help but also conside
by raydiatian 4y ago
> I really don’t see the connection with programming
It may just be the stupid way my brain is wired. When I think about calculus I can’t help but also consider programming, and vice versa. Okay, Calculus is not a precursor to learning to code. But the DNA of calculus is definitely there.
First, how building blocks of programming and calculus are similar.
1) We can probably throw out the control flow concepts, although they vaguely map to the notion of intervals on evaluated integrals.
2) I said for loops are a generalization of Leibniz notation. I also said it’s a rough relation. You said you don’t see the parallel because you claim pure maths calculus deals with reals and computers are discrete. Yep. Real numbers are discrete at the infinitesimal limit (grab your torch and pitchforks). I hope this is enough explanation on that front. Loops roughly = integrals. It’s purely theoretical. I get that you can’t actually represent an infinite precision real using bytes.
Next, algorithms.
1) I think there’s another very loose but valuable perspective in which calculus and efficient algorithm implementation at least shop at the same grocery store, if not fool around on the down low. I can imagine every possible implementation for solving the knapsack problem as being distributed in a higher dimensional space. There are a ton of bad ones out there with dogshit runtimes. But somewhere near the middle is one that goes zoooooom. That’s an optimization problem—that’s calculus.
2) And then within solving a problem itself. The *good* solutions make use of derivative-like notions. Properties about the problem which you use to solve it efficiently are effective pseudo-derivatives. The way that you can use a derivative plus a point to approximate some next point forward, you can use problem topology plus current state to improve state a bit further until you converge upon an “answer”.
The list goes on.
Calculus is in programming and programming is in calculus. They are cross-pollenated dialects of the mother tongue of the universe.
- Tainnor 4y ago> Real numbers are discrete at the infinitesimal limit (grab your torch and pitchforks). I don't even know what that means. If you embed the real numbers in the hyperreals, where you do in fact have "infinitely close" numbers, those numbers aren't discrete either, as the hyperreal numbers are dense too. > Loops roughly = integrals I think this is the wrong way around. Loops loosely correspond to mathematical sums (finite or possibly countably infinite). We got integrals once people started asking themselves "what if you could have something like sums, but over intervals that are arbitrarily/infinitely small?". In that sense, integrals are an extension or generalisation of sums/loops - in the sense that sums are basically integrals with a discrete measure - but you don't need to more complicated, general concept to understand the simpler one. Of course, different areas of maths (and CS is basically a branch of maths) are inter-linked. That's the beauty of maths. Some people will see calculus everywhere, others will immediately see connections to category theory, logic, topology, etc. Maybe in 50 years we will discover a new branch of maths and suddenly see that it can be found everywhere, but that doesn't mean that we needed to know that branch to do all the things we were doing up until that point. But I don't think calculus is as fundamental to CS/programming as it is to, say, physics or much of the rest of the natural sciences. You do mention some examples (optimisation problems), but by and large I don't need to understand limits and Cauchy sequences to program a loop or even to prove statements about push-down automata or graphs or my favourite type system. (You mention topology. Topology is an abstraction over analysis which can be used in discrete settings too, it doesn't fundamentally require the real numbers.)
- raydiatian 4y ago> (You mention topology. Topology is an abstraction over analysis which can be used in discrete settings too, it doesn't fundamentally require the real numbers.) Ugh I wanted to respond but this little quip puts the rest of your post into perspective about what an obnoxious person you must be.
- nuancebydefault 4y agoAs programmer (20+ years of experience) with a master degree in engineering, I think I can compare programming with calculus. In general, calculus is continuous, while most of programming is discrete. I dare to say that you can be a very good programmer without knowing derivatives and integrals, which are only at the very basis of calculus. Most formulas used while programming, have already been derived by a physicist or mathematic. Most (99 per cent) of programming paradigms can be fully understood and applied without calculus. I learned about exponential functions, logarithms and for loops way before knowing calculus.