Math and programming

Source: Internet
Author: User

Many people letter asked me, to become a good programmer, the basis of mathematics to achieve what degree? 18 years ago, when I was a freshman in the University of Computer science, I was plagued by the same problems. In the face of learning mathematics, physics and other subjects of students, I feel inferior. Often some people say that those professional knowledge more essence, more difficult, those professional people after graduation if do programming work, the level is actually higher than the computer department graduate. It was not until a few years ago that I had a thorough study of the programming language that I got the answer and the relief. Because a lot of novice programmers encounter the same problem, so I would like to explain this issue in detail here.

  Mathematics is not the basis of computer science

Many people mistakenly believe that computer science is a branch of mathematics, mathematics is the basis of computer science, mathematics is more profound science. These people think that as long as the learning of mathematics, programming things are nothing, but the fact is not so.

The fact is this:

    • Computer science is not mathematics at all, it just borrows very little, very basic mathematics, it is easier than high school math. The so-called "advanced mathematics", in computer science is basically not used.
    • Computers are more basic tools than math, just like paper and pens. Computers can be used to solve mathematical problems, but also to solve problems that are not mathematical, such as engineering problems, art problems, economic problems, social problems and so on.
    • Computer science is a completely independent discipline. Learning Mathematics and physics is not a substitute for the study of computer science. You have to study computer science to be a good programmer.
    • The language used by mathematicians is, in fact, a very backward and bad design compared to common programming languages (such as C++,java). The so-called "mathematical Beauty", in fact, is mostly portentous.
    • 99% of mathematicians can't write decent code.

  Math is a terrible language.

This is not alarmist. If you delve into the theory of programming languages, you'll find that the symbols that mathematicians use are just a very bad programming language. Some of the mathematical theories are useful, but the language used by mathematicians to describe these theories is complex, inconsistent, composable (composability), simple, and usable. That's why most people have headaches when they see math. It is not that they are not smart enough, but that there is a problem with the "design" of mathematical language. When people study maths, there is only a little time to think about its essence, and most of the time is to toss it in the grammar.

To give a very simple example. If you say that x-1 means X 1 times (the reciprocal of X), what does f-1 mean? F-1 Times Square, F's reciprocal? Don't be deceived by the math teachers ' dogma and excuses, they always tell you: "You should remember this!" "But have you ever thought:" Why? "X-1 means x 1 times, and f-1, obviously, is exactly the same form, which represents the inverse function of function f." One is the power, one is the inverse function, the wind horse is inferior, but writes a look. Such language design is confusing, but like to "conventional" as an excuse.

If you look at some more math books, you will find that this is just the tip of the iceberg of the hundreds of-year-old accumulated dross of mathematical language. Mathematics books are full of various superscript subscript, with brackets superscript subscript, x,y,z,a,b,c,f,g,h, all kinds of twisted to twist the Greek alphabet, the Hebrew alphabet ... Italic, blackbody, flower body, double shadow, ... Use different fonts to represent different "types". The meanings of many symbols are different in various sub-domains. Some people went to a math class and didn't understand what those symbols meant at the end.

Many people find it difficult to learn calculus, but the problem is not in them, but in Leibniz (Leibniz). Leibniz designed to describe the language of calculus (∫,DX, dy, ...). From the point of view of modern language design, in fact, very bad, can be said to be a mess. I can not blame Leibniz, he is hundreds of years ago, after all, he did not know that we now know a lot of things. However, the design of the ancients, and now do not consider the improvement, but as a doctrine instilled in the students, that is not thinking enterprising.

The language of mathematics is not like a programming language, its history is too long, no systematic, thoughtful, unified design. The emergence of various mathematical symbols, often a mathematician in the history of the day on the blackboard to draw some strange symbols, said this represents what, that represents what, ... And then it was settled. Many mathematicians only care about their narrow sub-domain and design a set of symbols for their own theories, regardless of whether they conflict with other sub-domain symbols. This is why different numbers of students in the field of writing the same symbol, but can express a completely different meaning. In this sense, the language of mathematics is somewhat similar to Perl (a very bad programming language). Perl adds a variety of functions that people need, without any choice, into the language, causing the language to be complicated, and even the creators of Perl cannot understand all of its functions.

Mathematics proves that the use of the language is also extremely non-strict-odd symbols, coupled with vague, easily misunderstood human language. If you know what a curry-howard correspondence will understand, in fact every mathematical proof is just a piece of code. The same theorem can have many different versions of the proofs (code). Some of these proofs are short and elegant, and some are lengthy and complex, and they can be wrapped around like noodles and can't be understood. You often see "undefined variables" in the mathematical proofs, and the logic of proof contains all kinds of tacit knowledge, thinking jumps, very difficult to understand. Many mathematical proofs, from the point of view of the program, even the compilation will not pass, let alone run.

Mathematicians often don't care about the elegance of proof. They think that as long as they can prove the theorem, you control my proof Jane is not simple, can not easily understand it. The more you do not understand, the more you feel me inscrutable! This trend of thought to the programming time shows the drawbacks. Mathematicians write code, often ignoring the code of elegance, simplicity, modularity, readability, performance, data structure, and other important factors, think the code as long as the results can be calculated. They take the code as a proof, a one-time thing, so their code often does not meet the strict requirements of the actual project.

  Programming is an art

From the above you may have learned that the programming language used by ordinary programmers, even in the case of C + +, is a lot more sophisticated than the language used by mathematicians. Computer science is not a branch of mathematics, it is much better than mathematics, higher than mathematics. Some basic theories of mathematics can be used in computer science, but computer science is not a part of mathematics. Mathematics in the language with too many remnants of history, it is actually a clay Buddha across the river, it is impossible, it can not solve the practical problems in programming.

Programming is really an art, because it conforms to the various characteristics of art. Art can take advantage of the tools provided by science, but it is not a part of science, and its status is not less than science. Like all art, programming solves problems that science can't solve, meets people's new needs, and opens up a new world. So dear programmers, stop worrying about not knowing a lot of math. Math doesn't help you write good programs, but people who can write good programs can understand math better. I suggest you learn programming first and then go to math.

Math and programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.