6 ms·
Programming isn't analogous to math, programming is a communication language with really strict rules that uses math of all stages. Different tasks involve diff
by simonsarris 13y ago
Programming isn't analogous to math, programming is a communication language with really strict rules that uses math of all stages. Different tasks involve different math. I'll give some common examples for laymen, but they may seem obvious in hindsight:
Programming a very rudimentary "snake" computer game is [using] using Algebra. If your son (or anyone) understands variables, assignment and adding them together, they fundamentally understand Algebra.
Programming a the general parts of a diagramming library or a game with some physics is [using] Geometry and Trig.
Programming complex features of a diagramming library involve discrete math and graph theory.
Programming diagramming layouts can involve Masters level math understanding. (Sometimes, even when the algorithm is well known, it can take months to understand and implement, like planarity testing and embedding before 2004[1])
So it's roughly analogous to the difficulty and specificity of the task, which varies wildly.
~~~
[1] in 2004 there was a fast and "easier" to understand planarity testing and embedding algorithm, I suggest you skim it for an idea of the kind of math programmers can get into: http://jgaa.info/accepted/2004/BoyerMyrvold2004.8.3.pdf http://jgaa.info/accepted/2004/BoyerMyrvold2004.8.3.pdf
- derleth 13y ago> If your son (or anyone) understands variables, assignment and adding them together, they fundamentally understand Algebra. A more important part of algebra is symbol manipulation, and understanding why some manipulations are valid and others are invalid. That symbol manipulation is the core of grade-school (or trivial) algebra. Being able to 'see' how to solve a problem, and being able to abstract general rules to solve whole classes of problems, all flow from that. Of course, there's a disconnect between using '=' to denote a state of being (the state of equality) and using '=' to denote an action (the action of assignment). As an example, 'x = x + 1' is either trivially nonsense or trivially valid. Haskell actually uses '=' in the mathematical sense, to denote a state of being, and SSA languages such as Erlang come pretty close to it, I think.
- tikhonj 13y agoMathematics is also a "communication language with really strict rules". In one sense, programming often uses math. And math often uses programming. But, in a deeper sense, programming is math and math is programming. They're just different views on the same underlying ideas. They're different fields of study mainly because the priorities are so different. Of course, this doesn't mean it makes sense to map Objective-C programming onto some "level" of math. For one, the whole math scale is completely arbitrary--who is to say that abstract algebra is more advanced than calculus? They're orthogonal. Moreover, Objective-C is in a part of programming which has really, really different priorities from normal mathematics. I still maintain that they're fundamentally related, but you're doing such different things that there's very little practical overlap. Certainly not enough to translate to some common sub-field of mathematics, much less one taught to high-schoolers!
- boomlinde 13y agoMathematics can easily be applied to anything from cooking to theoretical physics. That doesn't make any of these things math or the other way around. You can use math to solve a programming problem (perhaps to a greater extent than in cooking) and you can express many of the problems in mathematical terms, but in the end math is an abstract tool and programming is not.
- tikhonj 13y agoNo, the relationship between programming and mathematics is much deeper than that. In particular, it's not a relationship to the sort of mathematics you are thinking of--not the sort that you would use to solve a concrete problem or apply to physics or cooking. Rather, the relationship is between what a program is and the very foundations of mathematics--formal logic. In particular, a programming language is a formal system exactly the same way a logic is a formal system. A mathematical proof is really the same sort of object as a computer program. It just turns out that the goals behind the two are different, so the rules of the formal system (either a logic or a programming language) behave very differently. But, at a high level, it's the same idea. In fact, the way we ascribe semantics to programs and programming languages is analogous to how we can reason about proofs and logics. As a rough comparison, denotational semantics are like model theory and operational semantics are (sort of) like proof theory. That said, for the most part, this relationship to mathematics is actually orthogonal to the sort of math you would use in writing a program. Linear algebra, geometry, group theory and so on are great for applications but not what I was talking about. Instead, the mathematics I was alluding to only comes out when you get sufficiently "meta" and start writing programs that operate on other programs--static analysis, verification and so on. I'm not sure what you mean by "abstract tool", but programming is just as much an abstract tool as mathematics. The only difference is that we have some handy hardware for realizing the former.
- pavelrub 13y agoThis is philosophical mumbo-jumbo. When people program, they (usually) don't do math. And that's it. The fact that you can view a programming language as a formal system, and the fact that computer programs can be viewed as mathematical proofs of mostly totally uninteresting propositions, doesn't magically turn programmers into mathematicians, just as the fact that the brain can be viewed as a chemical and physical system doesn't turn every thought into a chemical experiment, and each thinking person into a chemist. Saying otherwise is just an abuse of language.
- chacham15 13y agoTo add: Programming a first person shooter requires linear algebra. Programming crypto-algorithms require discrete math.
- yodsanklai 13y ago"Programming isn't analogous to math" I think it's analogous to math in the sense that a programming language is a formal system, just like any logical system. The syntax is defined by formal rules, it semantics if not defined formally is strictly defined by the compiler implementation or hardware. Actually, the link between programming and proving as been characterized by the "curry-howard isomorphism" that says that a program is a proof of his type. In that sense, programming = writing a proof. For instance, in ML : the program "fun (x,y) -> x" is a proof of the proposition "A and B => A". This idea can be extended to more complex types/propositions (see the Coq proof assistant for instance). That being said, writing programs usually require different set of skills than doing mathematics. The best programmers are not always the best mathematicians and conversely. To me difference shows especially for big complex software, rather than smart algorithms in programming contests for instance.
- jheriko 13y ago"If your son (or anyone) understands variables, assignment and adding them together, they fundamentally understand Algebra." This seems like it should be so, but real world experience tells me it is not. Understanding how someone can understand one and not the other is beyond me, but its exceptionally common and a huge stumbling block for me to teach people programming. The fact that we are usually writing relations in algebra, but instruction statements in programming is really quite significant, even if they look similar.
- onetwofiveten 13y ago"uses math of all stages" - I don't think so! Source - post-doctorial mathematical researcher.
- deleted 13y ago[deleted]
- coldtea 13y ago>Programming isn't analogous to math, programming is a communication language with really strict rules that uses math of all stages. Different tasks involve different math. What kind of specialiazed math formulas you might need for some specific parts of a program is another thing altogether to whether programming in the large itself is analogous to math. Of course if you need to do FFT you will need a specific set of math. But programming the main logic of any program is quite similar at their level of analogue-ness to math.
- sophacles 13y agoAlgebra, at least in the high-school algebra sense[1], is just really strict rules for communicating points on a (line, plane, etc). It is a bunch of operations for finding an equivalent way of stating the same thing, and some rules for reasoning about those points. For example, finding the roots of a function is nothing more than manipulating a statement until you find out where y = 0. In a direct use way - any time you program with conditionals you are directly applying boolean algebra. There is no way around it - you have to understand how the basic rules of boolean algebra work. e.g. how does 'not' distribute, how do "AND" and "OR" work, etc. And it certainly helps with simplifying code if you can apply DeMorgan's law or distribute your conditions differently. There is a reason it's called refactoring code - it is just applying the algebra rules (usually the boolean ones) to program flow. Similarly, but a bit more abstract, string primitive operations are an algebra for working with series of characters. They are equally strict, although not the exact same rules as those for points on a curve. For instance associativity doesn't apply to addition. Multiplication isn't defined for some languages, and there are different ways to define it for other languages (does it distribute, etc). This isn't even that abstract... Given a string, solve for the character at position x. This is not really different than given a function, solve for the position at x. Given a function, and value y, solve for x. Its the same as given string, find the indices for a character. The operations are a bit different, but the reasoning between them is exactly the same: manipulate the givens with the rules that are defined. Use the rules to find properties of the target. [1] there are other algebras - for example ring theory algebra. It has rules that are different (mostly generalizations of basic algebra rules, but that have weird and non-intuitive results if all you know is basic high-school algebra). This sentence from the wikipedia article explains it well: "It follows that algebra, instead of being a true branch of mathematics, appears nowadays, to be a collection of branches sharing common methods."
- Someone 13y agoThanks for that link. One thing caught my eye: the algorithm starts with a depth first walk of the graph. Reading that, I thought "that n must be the number of edges". However, theorem 1 in section 6 starts with "Given a graph G with n vertices" and the proof starts with "The depth first search [...] implemented with well-known linear time algorithms." I don't know that well-known algorithm, and neither does Google, it seems. At least, I can't find it, and can't see how it would work. Now, section 5 has a procedure that requires <= 3n-5 edges for a graph with n vertices. Is that supposed to hold throughout? If so, what's that 3n-5 about? Are there well-known theorems or algorithms to disprove planar it's for such graphs?
- mdellabitta 13y ago> Programming isn't analogous to math https://en.wikipedia.org/wiki/Curry-Howard_isomorphism https://en.wikipedia.org/wiki/Curry-Howard_isomorphism
- derleth2 13y ago> If your son (or anyone) understands variables, assignment and adding them together, they fundamentally understand Algebra. A more important part of algebra is symbol manipulation, and understanding why some manipulations are valid and others are invalid. That symbol manipulation is the core of grade-school (or trivial) algebra. Being able to 'see' how to solve a problem, and being able to abstract general rules to solve whole classes of problems, all flow from that. Of course, there's a disconnect between using '=' to denote a state of being (the state of equality) and using '=' to denote an action (the action of assignment). As an example, 'x = x + 1' is either trivially nonsense or trivially valid. Haskell actually uses '=' in the mathematical sense, to denote a state of being, and SSA languages such as Erlang come pretty close to it, I think.