程序員怎樣學數學

發布時間: 2011-02-02 13:33  閱讀: 14898 次  推薦: 9   原文鏈接   [收藏]  

英文原文:Math For Programmers

I've been working for the past 15 months on repairing my rusty math skills, ever since I read a biography of Johnny von Neumann. I've read a huge stack of math books, and I have an even bigger stack of unread math books. And it's starting to come together. 

自從我讀了Johnny von Neumann的傳記,我已經為彌補我糟糕的數學技能花了15個月了。讀了大量的數學書籍,不過呢,似乎我還有更多沒有讀,當然我會接著做的。

Let me tell you about it. 
現在我就來告訴你這些。

Conventional Wisdom Doesn't Add Up 
告別傳統觀念

First: programmers don't think they need to know math. I hear that so often; I hardly know anyone who disagrees. Even programmers who were math majors tell me they don't really use math all that much! They say it's better to know about design patterns, object-oriented methodologies, software tools, interface design, stuff like that. 

首先: 程序員不認為他們需要了解數學。我常常聽到這樣的話。我不知道還有沒有不同意的,甚至于以前是主修數學的程序員也告訴我,他們真的不是常常使用到數學!他們說更重要的是要去了解設計模式,面向對象原理,軟件工具,界面設計,以及一些其他類似的東西。

And you know what? They're absolutely right. You can be a good, solid, professional programmer without knowing much math. 
你了解嗎?他們完全正確。你不需要了解很多數學,你就能做個很棒,很專業的程序員。
But hey, you don't really need to know how to program, either. Let's face it: there are a lot of professional programmers out there who realize they're not very good at it, and they still find ways to contribute. 
但是呢,同時你也不是真的需要知道如何來編程。我們要面對的是:有很多專業的程序員,他們認識到他們不是非常擅長數學,但他們還是尋找方法去提升。
If you're suddenly feeling out of your depth, and everyone appears to be running circles around you, what are your options? Well, you might discover you're good at project management, or people management, or UI design, or technical writing, or system administration, any number of other important things that "programmers" aren't necessarily any good at. You'll start filling those niches (because there's always more work to do), and as soon as you find something you're good at, you'll probably migrate towards doing it full-time. 

如果你突然覺得自己好爛,周圍的人都遠遠的超過你,你會怎么想呢?好,你可能會發現自己善于項目管理,或人事管理,或界面設計,或技術寫作,或系統管理,還有許多其他程序員不必去精通的。你會開始堆積那些想法(因為工作永遠干不完),當你發現一些你能掌握的東西時,你很可能會轉移去全職的做這個工作。
In fact, I don't think you need to know anything, as long as you can stay alive somehow. 
實際上,我認為有些東西你不需要了解,當前你還能夠賴以生存的話。
So they're right: you don't need to know math, and you can get by for your entire life just fine without it. 
所以他們是對的:你不需要了解數學,并且沒有數學你也能過的很好。
But a few things I've learned recently might surprise you: 
但是最近我學到的一些東西可能會讓你感到驚訝:
Math is a lot easier to pick up after you know how to program. In fact, if you're a halfway decent programmer, you'll find it's almost a snap. 
在你知道如何編程之后,學數學會更容易。實際上,如果你是一個還算不錯的程序員,你會發現學數學幾乎是小菜一碟。
They teach math all wrong in school. Way, WAY wrong. If you teach yourself math the right way, you'll learn faster, remember it longer, and it'll be much more valuable to you as a programmer. 
學校里教數學的方式都錯了。僅僅是教學的方法錯了,不是教數學本身錯了。如果你以正確的方式學習數學的話,你會學的更快,記住這點,對你,作為一個程序員來說很有價值。
Knowing even a little of the right kinds of math can enable you do write some pretty interesting programs that would otherwise be too hard. In other words, math is something you can pick up a little at a time, whenever you have free time. 
哪怕了解一點點相關的數學知識,就能讓你寫出可愛有趣的程序,否則會有些小難度。換句話講,數學是可以慢慢學的,只要你有時間。
Nobody knows all of math, not even the best mathematicians. The field is constantly expanding, as people invent new formalisms to solve their own problems. And with any given math problem, just like in programming, there's more than one way to do it. You can pick the one you like best. 
沒人能了解所有的數學,就是最棒的數學家也不能。當人們發明新的形式去解決自己的問題時,數學領域就不斷的擴展。和編程一樣,一些給出的數學問題,不止一種方法可以去解決它。你可以挑個你最喜歡的方式。
Math is... ummm, please don't tell anyone I said this; I'll never get invited to another party as long as I live. But math, well... I'd better whisper this, so listen up: (it's actually kinda fun.) 
數學是......嗯,請別告訴別人我說過這個哈;當然我也不指望誰能邀請我參加這樣的派對,在我還活著的時候。但是,數學其實就是......我還是小聲的說吧,聽好了:(她其實就是一種樂趣啦!)

The Math You Learned (And Forgot) 
你學到的數學(和你忘了的數學) 

Here's the math I learned in school, as far as I can remember: 
這兒是我能記得的在學校學到的數學: 
Grade School: Numbers, Counting, Arithmetic, Pre-Algebra ("story problems") 
小學:數,數數,算術知識,初級代數("帶問題的小故事") 。
High School: Algebra, Geometry, Advanced Algebra, Trigonometry, Pre-Calculus (conics and limits) 
中學:代數,幾何,高等代數,三角學,微積分先修課 (二次曲線論和極限)。
College: Differential and Integral Calculus, Differential Equations, Linear Algebra, Probability and Statistics, Discrete Math 
大學:微積分,微分公式,線性代數,概率和統計,離散數學。
How'd they come up with that particular list for high school, anyway? It's more or less the same courses in most U.S. high schools. I think it's very similar in other countries, too, except that their students have finished the list by the time they're nine years old. (Americans really kick butt at monster-truck competitions, though, so it's not a total loss.) 
上面那個關于高中數學課程單子上所列的,怎么來著?美國高中幾乎都是這樣的課程設置。我認為其他國家也會很相似的,除了那些在9歲之前就掌握了這些課程的學生。(美國小孩同時卻在熱衷于玩魔鬼卡車競賽,雖然如此,整個來說也算不上什么大損失。) 
Algebra? Sure. No question. You need that. And a basic understanding of Cartesian geometry, too. Those are useful, and you can learn everything you need to know in a few months, give or take. But the rest of them? I think an introduction to the basics might be useful, but spending a whole semester or year on them seems ridiculous. 
代數?是的,沒問題。你需要代數,和一些理解解析幾何的知識。那些很有用,并且在以后幾個月里,你能學到一切你想要的,十拿九穩的。剩下的呢?我認為一個基本的介紹可能會有用,但是在這上面花整個學期或一年就顯得很荒謬了。

I'm guessing the list was designed to prepare students for science and engineering professions. The math courses they teach in and high school don't help ready you for a career in programming, and the simple fact is that the number of programming jobs is rapidly outpacing the demand for all other engineering roles. 

我現在意識到那個書單列表是設計給那些以后要當科學家和工程師的學生的。他們在高中里所教的數學課程并不是為你的編程生涯做準備的,簡單的事實是,多數的編程工作所需要的數學知識,相比其他工程師角色增長的更快。
And even if you're planning on being a scientist or an engineer, I've found it's much easier to learn and appreciate geometry and trig after you understand what exactly math is — where it came from, where it's going, what it's for. No need to dive right into memorizing geometric proofs and trigonometric identities. But that's exactly what high schools have you do. 
即使你打算當一名科學家或者一名工程師,在你理解了什么是數學之后——數學從何而來,走向哪里,為何而生,你會發現學習和欣賞幾何學和三角學變得更容易了。不必去記住幾何上的證明和三角恒等式,雖然那確實是高中學校要求你必須去做的。
So the list's no good anymore. Schools are teaching us the wrong math, and they're teaching it the wrong way. It's no wonder programmers think they don't need any math: most of the math we learned isn't helping us. 
所以,這樣的書單列表不再有什么用了。學校教給我們的不是最合適的數學,并且方式也不對,難怪程序員認為他們不再需要數學:我們學的大部分數學知識對我們的工作沒什么大的幫助。

The Math They Didn't Teach You 
他們沒有教給你的那部分數學

The math computer scientists use regularly, in real life, has very little overlap with the list above. For one thing, most of the math you learn in grade school and high school is continuous: that is, math on the real numbers. For computer scientists, 95% or more of the interesting math is discrete: i.e., math on the integers. 

在現實中,計算機科學家經常使用的數學,跟上面所列的數學僅有很小的重疊。舉個例子,你在中學里學的大部分數學是連續性的,也就是說,那是作為實數的數學。而對于計算機科學家來說,他們所感興趣的95%也許更多的是離散性的,比如,關于整數的數學。
I'm going to talk in a future blog about some key differences between computer science, software engineering, programming, hacking, and other oft-confused disciplines. I got the basic framework for these (upcoming) insights in no small part from Richard Gabriel's Patterns Of Software, so if you absolutely can't wait, go read that. It's a good book. 

我打算在以后的博客中再談一些有關計算機科學,軟件工程,編程,搞些有趣的東東,和其他常常令人犯暈的訓練。我已經從Richard Gabriel的《軟件的模式》這本書中洞察到一個無關巨細的基本框架。如果你明顯的等不下去的話,去讀吧,是本不錯的書。
For now, though, don't let the term "computer scientist" worry you. It sounds intimidating, but math isn't the exclusive purview of computer scientists; you can learn it all by yourself as a closet hacker, and be just as good (or better) at it than they are. Your background as a programmer will help keep you focused on the practical side of things. 
從現在開始,不要再讓"計算機科學家"這個詞困擾到你。它聽上去很可怕,其實數學不是計算機科學家所獨有的領域。你也能作為一個黑客自學它,并且能做的和他們一樣棒。你作為一個程序員的背景,將會幫助你保持只關注那些有實踐性的部分。
The math we use for modeling computational problems is, by and large, math on discrete integers. This is a generalization. If you're with me on today's blog, you'll be studying a little more math from now on than you were planning to before today, and you'll discover places where the generalization isn't true. But by then, a short time from now, you'll be confident enough to ignore all this and teach yourself math the way you want to learn it. 
我們用來建立計算模型的,大體上是離散數學,這是普遍的做法。如果正好今天你在看這篇博客,從現在起你正了解到更多的數學,并且你會認識到那樣的普遍做法是不對的;從現在開始,你將有信心認為可以忽略這些,并以你想要的方式自學。
For programmers, the most useful branch of discrete math is probability theory. It's the first thing they should teach you after arithmetic, in grade school. What's probability theory, you ask? Why, it's counting. How many ways are there to make a Full House in poker? Or a Royal Flush? Whenever you think of a question that starts with "how many ways..." or "what are the odds...", it's a probability question. And as it happens (what are the odds?), it all just turns out to be "simple" counting. It starts with flipping a coin and goes from there. It's definitely the first thing they should teach you in grade school after you learn Basic Calculator Usage. 
對程序員來說,最有效的離散數學的分支是概率理論。這是你在學校學完基本算術后緊接著的課。你會問,什么是概率理論呢?你就數啊,看有多少次出現滿堂彩?或者有多少次是同花順。不管你思考什么問題,如果是以"多少種途徑..."或"有多大幾率的...",那就是離散問題。當它發生時,都轉化成"簡單"的計數,拋個硬幣看看...? 毫無疑問,在他們教你基本的計算用法后,他們會教你概率理論。
I still have my discrete math textbook from college. It's a bit heavyweight for a third-grader (maybe), but it does cover a lot of the math we use in "everyday" computer science and computer engineering. 
我還保存著大學里的離散數學課本,可能它只占了三分之一的課程,但是它卻涵蓋了我們幾乎每天計算機編程工作大部分所用到的數學。
Oddly enough, my professor didn't tell me what it was for. Or I didn't hear. Or something. So I didn't pay very close attention: just enough to pass the course and forget this hateful topic forever, because I didn't think it had anything to do with programming. That happened in quite a few of my comp sci courses in college, maybe as many as 25% of them. Poor me! I had to figure out what was important on my own, later, the hard way. 
也真是夠奇怪的,我的教授從沒告訴我數學是用來干嗎的,或者我也從來沒有聽說過,種種原因吧。所以我也從沒有給以足夠的注意,只是考試及格,然后把他們都忘光,因為我不認為它還和編程有啥關系。事情變化是我在大學學完一些計算機科學的課程之后,也許是25%的課程,可憐啊!我必須弄明白什么對于自己來說是最重要的,然后再是向深度發展。
I think it would be nice if every math course spent a full week just introducing you to the subject, in the most fun way possible, so you know why the heck you're learning it. Heck, that's probably true for every course. 
我想,如果每門數學課都花上整整一周的時間,而只是介紹讓你如何入門的話,那將非常不錯。這是最有意思的一種假設,那么你知道了你正學習的對象是哪種怪物了。怪物,大概對每一門課都合適。
Aside from probability and discrete math, there are a few other branches of mathematics that are potentially quite useful to programmers, and they usually don't teach them in school, unless you're a math minor. This list includes: 
除了概率和離散數學外,還有不少其他的數學分支,可能對程序員相當的有用。學校通常不會教你的,除非你的輔修科目是數學,這些數目列表包括:

Statistics, some of which is covered in my discrete math book, but it's really a discipline of its own. A pretty important one, too, but hopefully it needs no introduction. 
統計學,其中一些包括在我的離散數學課里,它的某些訓練只限于它自身,自然也是相當重要的,但想學的話不需要什么特別的入門。
Algebra and Linear Algebra (i.e., matrices). They should teach Linear Algebra immediately after algebra. It's pretty easy, and it's amazingly useful in all sorts of domains, including machine learning. 
代數和線性代數(比如:矩陣),他們會在教完代數后立即教線性代數。這也簡單,但這在相當多的領域非常有用,包括機器學習。
Mathematical Logic. I have a really cool totally unreadable book on the subject by Stephen Kleene, the inventor of the Kleene closure and, as far as I know, Kleenex. Don't read that one. I swear I've tried 20 times, and never made it past chapter 2. If anyone has a recommendation for a better introduction to this field, please post a comment. It's obviously important stuff, though. 
數理邏輯,我有相當完整的關于這門學科的書沒有讀,是Stephen Kleene寫的,克林閉包的發明者。我所知道的還有就是Kleenex, 這個就不要讀了,我發誓我已經嘗試了不下20次,卻從沒有讀完第二章。如果哪位牛掰有什么更好的入門建議的話,可以給我推薦。顯然,這門學科明顯是非常重要的一部分。
Information Theory and Kolmogorov Complexity. Weird, eh? I bet none of your high schools taught either of those. They're both pretty new. Information theory is (veeery roughly) about data compression, and Kolmogorov Complexity is (also roughly) about algorithmic complexity. I.e., how small you can you make it, how long will it take, how elegant can the program or data structure be, things like that. They're both fun, interesting and useful. 
信息理論和柯爾莫戈洛夫復雜性理論,真不可思議,不是么?我敢打賭沒哪個高中會教你其中任何一門課程。它們都是新興的學科。信息理論(相當相當相當相當難懂)是關于數據壓縮,柯爾莫戈洛夫復雜性理論(同樣非常難懂)是關于算法復雜度的。也就是說,你要把它壓縮的盡量小,你所要花費的時間也就變的越長;同樣的,程序或數據結構要變得多優雅,也有同樣的代價。它們都很有趣,也很有用。
There are others, of course, and some of the fields overlap. But it just goes to show: the math that you'll find useful is pretty different from the math your school thought would be useful. 
當然,也有其他的一些因素,某些領域是重復的。也拿來說說吧,你所發現有用的那部分數學,不同于那些你在學校里認為有用的數學。
What about calculus? Everyone teaches it, so it must be important, right? 
那微積分呢?每個人都學它,所以它也一定是重要的,對嗎? 
Well, calculus is actually pretty easy. Before I learned it, it sounded like one of the hardest things in the universe, right up there with quantum mechanics. Quantum mechanics is still beyond me, but calculus is nothing. After I realized programmers can learn math quickly, I picked up my Calculus textbook and got through the entire thing in about a month, reading for an hour an evening. 

好吧,微積分實際上是相當容易的。在我學習它之前,它聽上去好像是世界上最難的一件事,好像和量子力學差不多。量子力學對我來說真的不是那么容易理解,但是微積分卻不是。在我意識到程序員能夠快速的學習數學時,我拿起一些微積分課本用一個月通讀了整本書,一個晚上讀一小時。
Calculus is all about continuums — rates of change, areas under curves, volumes of solids. Useful stuff, but the exact details involve a lot of memorization and a lot of tedium that you don't normally need as a programmer. It's better to know the overall concepts and techniques, and go look up the details when you need them. 

微積分都是關于連續統的 -- 變化的比率,曲線的面積,立體的體積,是些有用的東西,但是實際細節卻包含大量的記憶量并且枯燥,作為一個程序員來說根本不需要這些。更好的方法是從整體上了解那些概念和技術,在必要的時候再去查詢那些細節。
Geometry, trigonometry, differentiation, integration, conic sections, differential equations, and their multidimensional and multivariate versions — these all have important applications. It's just that you don't need to know them right this second. So it probably wasn't a great idea to make you spend years and years doing proofs and exercises with them, was it? If you're going to spend that much time studying math, it ought to be on topics that will remain relevant to you for life. 
幾何,三角,微分,積分,圓錐曲線,微分方程,和他們的多維和多元 -- 這些都有重要的應用。不過這時候不需要你去了解它們,這大概不是個好注意,讓你年復一年的去做證明和它們的練習題,不是嗎?如果你打算花大量的時間去學習數學,那也是和你生活相關的部分。

The Right Way To Learn Math 
學習數學的正確方法

The right way to learn math is breadth-first, not depth-first. You need to survey the space, learn the names of things, figure out what's what. 
正確學習數學的方法是廣度優先,而非深度優先。你要考察的是整個數學世界,學習每個概念的名字,區分出什么是什么。
To put this in perspective, think about long division. Raise your hand if you can do long division on paper, right now. Hands? Anyone? I didn't think so. 
具體來看,考慮用長除法?如果你能在紙上做長整除,現在就舉起你的手。會有人舉手嗎?至少我不這么認為。
I went back and looked at the long-division algorithm they teach in grade school, and damn if it isn't annoyingly complicated. It's deterministic, sure, but you never have to do it by hand, because it's easier to find a calculator, even if you're stuck on a desert island without electricity. You'll still have a calculator in your watch, or your dental filling, or something, 

回頭看看在學校里學過的長除法,要是不讓你覺得煩惱和憤怒才怪。當然,這是顯然的,但你不一定要自己親自去做,因為很容易用計算器來做。即使你不幸在一座沒有電力的荒無人煙的小島上,你起碼還有個計算器,在你的手表上,補牙的什么東東,或其他什么上面。 
Why do they even teach it to you? Why do we feel vaguely guilty if we can't remember how to do it? It's not as if we need to know it anymore. And besides, if your life were on the line, you know you could perform long division of any arbitrarily large numbers. Imagine you're imprisoned in some slimy 3rd-world dungeon, and the dictator there won't let you out until you've computed 219308862/103503391. How would you do it? Well, easy. You'd start subtracting the denominator from the numerator, keeping a counter, until you couldn't subtract it anymore, and that'd be the remainder. If pressed, you could figure out a way to continue using repeated subtraction to estimate the remainder as decimal number (in this case, 0.1185678219, or so my Emacs M-x calc tells me. Close enough!) 

為什么他們還教你這些呢?如果我們不能記住怎樣去做,為什么會感到含糊心虛呢?好像我們不需要再次知道它。除此以外,如果你命懸一線,你可以運用任意大的數來做長除法。想象你被囚禁在第三世界的地牢里,那兒的獨裁者是不會放你出來的,除非你計算出219308862/103503391。你會怎么做呢?好吧,很容易,你開始從分子減去分,,直到不能再減只剩余數為止。若實在有壓力,你可以想個辦法,繼續使用反復減,估算作為十進制的余數(這種情況下,0.1185678219, Emacs M-x calc 告訴我的,夠精確了! ) 

You could figure it out because you know that division is just repeated subtraction. The intuitive notion of division is deeply ingrained now. 
你或許明白,除法就是反復的減,這樣從直覺上對除法概念的理解就根深蒂固啦! 

The right way to learn math is to ignore the actual algorithms and proofs, for the most part, and to start by learning a little bit about all the techniques: their names, what they're useful for, approximately how they're computed, how long they've been around, (sometimes) who invented them, what their limitations are, and what they're related to. Think of it as a Liberal Arts degree in mathematics. 

學習數學的正確方法是忽略實際的算法和證明,對于大部分情況來說,他們的名字,他們的作用,他們計算的大致步驟,(有時是)誰發明了他們,發明了多久了,他們的缺陷是什么,和他們相關的有什么,把數學當文科來學。
Why? Because the first step to applying mathematics is problem identification. If you have a problem to solve, and you have no idea where to start, it could take you a long time to figure it out. But if you know it's a differentiation problem, or a convex optimization problem, or a boolean logic problem, then you at least know where to start looking for the solution. 
為什么呢?因為第一步反應在數學上的是問題的確定。如果你有一個問題去解決,并且假設你沒有頭緒如何開始,這將花費你很長的時間來弄明白。但如果你知道這是個變異的問題,或者是一個凸優化問題,或者一個布爾的邏輯問題,然后你起碼能知道從哪著手開始尋找解決方案。

There are lots and lots of mathematical techniques and entire sub-disciplines out there now. If you don't know what combinatorics is, not even the first clue, then you're not very likely to be able to recognize problems for which the solution is found in combinatorics, are you? 
現在有許許多多的數學技術和整個的學科分支。如果你不知道組合邏輯是什么,甚至連聽都沒聽說過,那么你是不可能意識到在組合邏輯中可以找到的答案解決的是什么問題,難道不是么? 
But that's actually great news, because it's easier to read about the field and learn the names of everything than it is to learn the actual algorithms and methods for modeling and computing the results. In school they teach you the Chain Rule, and you can memorize the formula and apply it on exams, but how many students really know what it "means"? So they're not going to be able to know to apply the formula when they run across a chain-rule problem in the wild. Ironically, it's easier to know what it is than to memorize and apply the formula. The chain rule is just how to take the derivative of "chained" functions — meaning, function x() calls function g(), and you want the derivative of x(g()). Well, programmers know all about functions; we use them every day, so it's much easier to imagine the problem now than it was back in school. 
但那實在是個大新聞,因為閱讀這些領域,學習實際算法,建模和計算結果的方法,記住這些名字都是容易的。在學校里他們教你鏈式法則。你也能回憶起他們并能運用在考試題上,但有多少學生能真正的了解他們到底意味著什么呢? 所以當他們遇到變種的鏈式問題時,他們就不懂得如何運用公式了。讓人感到諷刺的是,了解這是什么比記住如何運用公式更為容易。鏈式法則僅僅是如何對鏈式函數求導的意思,函數 x() 引用函數 g() , 你要求導 x(g()) 。好了,程序員知道所有這些函數相關的,我們每天都使用它們,所以現在比過去在學校更容易想象到問題所在。
Which is why I think they're teaching math wrong. They're doing it wrong in several ways. They're focusing on specializations that aren't proving empirically to be useful to most high-school graduates, and they're teaching those specializations backwards. You should learn how to count, and how to program, before you learn how to take derivatives and perform integration. 

這就是為什么我認為他們以錯誤的方式在教數學。老師們向大多數高中畢業生專門教授的內容,不是靠經驗來證明數學是如何如何有用的,而恰恰是相反。在你學習如何求導和做積分之前,你應該學習如何計數,怎樣編程。
I think the best way to start learning math is to spend 15 to 30 minutes a day surfing in Wikipedia. It's filled with articles about thousands of little branches of mathematics. You start with pretty much any article that seems interesting (e.g. String theory, say, or the Fourier transform, or Tensors, anything that strikes your fancy.) Start reading. If there's something you don't understand, click the link and read about it. Do this recursively until you get bored or tired. 
我認為學習數學最好的方法是每天花15到30分鐘逛維基百科,那上面有數千數學分支的相關文章,可以從一些你感興趣的文章著手(比如弦理論,或者傅立葉變換,或者張量理論,就是能沖擊你想象力的東西) 閱讀。如果有什么你不理解的,就去了解那些鏈接,如此這般直到你累到不行為止。
Doing this will give you amazing perspective on mathematics, after a few months. You'll start seeing patterns — for instance, it seems that just about every branch of mathematics that involves a single variable has a more complicated multivariate version, and the multivariate version is almost always represented by matrices of linear equations. At least for applied math. So Linear Algebra will gradually bump its way up your list, until you feel compelled to learn how it actually works, and you'll download a PDF or buy a book, and you'll figure out enough to make you happy for a while. 
幾個月后,這么做會縱向擴展你的數學知識面。你會發現一些模式,好比數學的每個分支看上去都包括了一個有著復雜的多元的變量,然后線性代數將會慢慢爬滿你的書單列表,直到你強迫自己學會它實際上是怎樣工作的,你要下載個電子書或買本書,直到你能從中找到樂趣。 
With the Wikipedia approach, you'll also quickly find your way to the Foundations of Mathematics, the Rome to which all math roads lead. Math is almost always about formalizing our "common sense" about some domain, so that we can deduce and/or prove new things about that domain. Metamathematics is the fascinating study of what the limits are on math itself: the intrinsic capabilities of our formal models, proofs, axiomatic systems, and representations of rules, information, and computation. 
憑借著維基百科,你也能快速的找到一條了解數學基本原理的途徑,條條大道通羅馬。在某些領域,數學幾乎總是形式化我們的"常識",所以我們能減少或證明那些領域里的新事物。對數學本身的研究就是無止境而且令人著迷的,構造形式模型本質的能力,證明,自明的系統,規則表示,信息和計算。
One great thing that soon falls by the wayside is notation. Mathematical notation is the biggest turn-off to outsiders. Even if you're familiar with summations, integrals, polynomials, exponents, etc., if you see a thick nest of them your inclination is probably to skip right over that sucker as one atomic operation. 
數學符號很重要,但卻容易讓人放棄。對于門外漢來說,數據符號是巨大的障礙。即使你熟悉累加,積分,多項式,指數等等,如果你看到堆徹的異常復雜的符號時,你就把它實現的功能當成一個原子操作好了,不要深究太多。
However, by surveying math, trying to figure out what problems people have been trying to solve (and which of these might actually prove useful to you someday), you'll start seeing patterns in the notation, and it'll stop being so alien-looking. For instance, a summation sign (capital-sigma) or product sign (capital-pi) will look scary at first, even if you know the basics. But if you're a programmer, you'll soon realize it's just a loop: one that sums values, one that multiplies them. Integration is just a summation over a continuous section of a curve, so that won't stay scary for very long, either. 
不管怎樣,認真去了解數學,嘗試著理解人們正在試圖解決的問題(那些已被證明了的問題某天也許會對你有實際用途),你會在符號中看到模式,你也不再排斥它們。比如,累加符號(大寫符號-西格馬)或者π(大寫符號-pi,連乘符號)起初看上去讓人心里沒底,即使你了解了它們的基本原理。但如果你是個程序員,你會認識到他僅僅是個循環:一個累加值,一個累乘,積分是一段連續曲線的相加,所以那不會讓你郁悶太久。
Once you're comfortable with the many branches of math, and the many different forms of notation, you're well on your way to knowing a lot of useful math. Because it won't be scary anymore, and next time you see a math problem, it'll jump right out at you. "Hey," you'll think, "I recognize that. That's a multiplication sign!" 

一旦你習慣了數學的許多分支,和許多不同格式的符號,你就走在了知道很多有用數學知識的路上。因為你不再害怕,你將會發現問題,其實它們會自動跳到你面前。“嗨,”你會思索,“我了解這個,這是乘法符號!”
And then you should pull out the calculator. It might be a very fancy calculator such as R, Matlab, Mathematica, or a even C library for support vector machines. But almost all useful math is heavily automatable, so you might as well get some automated servants to help you with it. 
這樣你就能扔掉計算器了。有一個充滿想象的計算器比如R, Matlab, Mathematica, 甚或是支持向量機的C語言庫,但幾乎所有有用的數學都是重型自動機,所以你能夠讓一切都變的自動化。
When Are Exercises Useful? 
練習有啥用處呢? 
After a year of doing part-time hobbyist catch-up math, you're going to be able to do a lot more math in your head, even if you never touch a pencil to a paper. For instance, you'll see polynomials all the time, so eventually you'll pick up on the arithmetic of polynomials by osmosis. Same with logarithms, roots, transcendentals, and other fundamental mathematical representations that appear nearly everywhere. 

在做了幾年的業余數學愛好者之后,你可以在腦海里做很多數學題,即使你從沒碰過筆和紙。比如,你會一直看到多項式,所以你會耳濡目染的做起多項式的運算。同樣的,對數,根,超越數,和其他到處出現的基本數學原理。

I'm still getting a feel for how many exercises I want to work through by hand. I'm finding that I like to be able to follow explanations (proofs) using a kind of "plausibility test" — for instance, if I see someone dividing two polynomials, I kinda know what form the result should take, and if their result looks more or less right, then I'll take their word for it. But if I see the explanation doing something that I've never heard of, or that seems wrong or impossible, then I'll dig in some more. 
對于我要親手做多少練習題,我有一種直覺。我用一種“真實性測試”跟隨證明步驟。比如,我看到有人除以兩個多項式,我大概知道結果是什么,如果它們的結果看上去差不多是對的,我就相信他們了。但如果我看到的那個證明我聽都沒聽說過,亦或看上去是錯的或者不可能的,我就要挖掘更多的東西了。
That's a lot like reading programming-language source code, isn't it? You don't need to hand-simulate the entire program state as you read someone's code; if you know what approximate shape the computation will take, you can simply check that their result makes sense. E.g. if the result should be a list, and they're returning a scalar, maybe you should dig in a little more. But normally you can scan source code almost at the speed you'd read English text (sometimes just as fast), and you'll feel confident that you understand the overall shape and that you'll probably spot any truly egregious errors. 
這很像讀程序源代碼,不是么?當你讀某人的代碼,你不需要手動模擬整個程序狀態;如果你知道計算過程大致會發生什么情形,你就能推斷出結果。舉個例子,如果結果應該是個列表,但返回的是一個標量,可能你就會更深入地研究。但正常情況下,你幾乎是以你閱讀英文文本的速度(有時僅僅是速度上)掃描源代碼,并且你確信理解了整個結構,但與此同時,你也許會發現令你震驚的錯誤。 
I think that's how mathematically-inclined people (mathematicians and hobbyists) read math papers, or any old papers containing a lot of math. They do the same sort of sanity checks you'd do when reading code, but no more, unless they're intent on shooting the author down. 

我認為數學愛好者(數學家和真正的數學迷)也是這樣閱讀數學論文的。和你讀代碼時一樣,他們也會做同樣的檢查,除非他們不想把作者的觀點駁倒。
With that said, I still occasionally do math exercises. If something comes up again and again (like algebra and linear algebra), then I'll start doing some exercises to make sure I really understand it. 
照那樣說,我會偶爾做做數學練習。如果某些問題(比如代數和線性代數)一次又一次的出現,我就做些練習去確認我是否真正的理解它了。
But I'd stress this: don't let exercises put you off the math. If an exercise (or even a particular article or chapter) is starting to bore you, move on. Jump around as much as you need to. Let your intuition guide you. You'll learn much, much faster doing it that way, and your confidence will grow almost every day.
但我要強調這點:不要讓練習使你分心。如果一個練習(甚或是一篇特別的文章或章節)開始讓你煩惱,那就暫時丟一邊繼續前進,該奔跑就堅決奔跑。讓你的直覺引導你。你會學到更多,更快,你的信心也會隨之增長。

How Will This Help Me? 
這些怎樣才能幫到我? 

Well, it might not — not right away. Certainly it will improve your logical reasoning ability; it's a bit like doing exercise at the gym, and your overall mental fitness will get better if you're pushing yourself a little every day. 
也許不能--不能立刻奏效。但確實能幫助提高你的邏輯推理能力;好比是在健身房進行鍛煉,如果你每天都做一點的話,你的身體素質肯定會得到提高。
For me, I've noticed that a few domains I've always been interested in (including artificial intelligence, machine learning, natural language processing, and pattern recognition) use a lot of math. And as I've dug in more deeply, I've found that the math they use is no more difficult than the sum total of the math I learned in high school; it's just different math, for the most part. It's not harder. And learning it is enabling me to code (or use in my own code) neural networks, genetic algorithms, bayesian classifiers, clustering algorithms, image matching, and other nifty things that will result in cool applications I can show off to my friends. 
對我來說,我已經注意到一些我感興趣的領域(包括人工智能,機器學習,自然語言處理和模式識別)大量用到數學。對于我研究的更深的領域,我發現它們所用的數學并不比我在中學學到的更難;多半是不同的數學,而不是更難了。并且學習數學使我能寫(或者是在我自己的代碼里使用)神經網絡,基因算法,貝頁斯分類器,集群算法,圖像識別,和其他時髦的東西,能產生很酷的應用,我可以向我的朋友炫耀。
And I've gradually gotten to the point where I no longer break out in a cold sweat when someone presents me with an article containing math notation: n-choose-k, differentials, matrices, determinants, infinite series, etc. The notation is actually there to make it easier, but (like programming-language syntax) notation is always a bit tricky and daunting on first contact. Nowadays I can follow it better, and it no longer makes me feel like a plebian when I don't know it. Because I know I can figure it out. 
我逐漸意識到這點,當別人給我看一篇包含數學公式的文章時,我不再突然冒出一身冷汗:組合,微分,真值表,定列式,無限系列等等。那些數學公式現在變得容易相處了,但(像編程語言的語法)剛開始接觸的時候多少還是讓人覺得復雜。現在我能更好的理解了,即使遇到不懂的地方,也不再感到自己是個不懂數學的人了。因為我知道自己是能夠弄明白的。
And that's a good thing. 
那很好。
And I'll keep getting better at this. I have lots of years left, and lots of books, and articles. Sometimes I'll spend a whole weekend reading a math book, and sometimes I'll go for weeks without thinking about it even once. But like any hobby, if you simply trust that it will be interesting, and that it'll get easier with time, you can apply it as often or as little as you like and still get value out of it. 
我會繼續加油做的更好滴。我還有不少活頭,有好多書和文章要讀。有時我會花整個周末來讀數學書,有時會數周都不再思考它。和其他興趣一樣,如果你相信它是有趣的,能通過它更容易的消磨時光,你就會時不時地去做,并從中獲益。
Math every day. What a great idea that turned out to be! 
好好學習,天天數學!

原文標題:Math For Programmers

原文來源:http://steve-yegge.blogspot.com/2006/03/math-for-programmers.html

9
1
 
標簽:程序員 數學
 
 

文章列表

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()