# 一个数学家的辩白

《一个数学家的辩白》是数学大师 Godfrey Harold Hardy 在 1940 年左右的作品，可以称之为 Hardy 本人的自传和内心独白。Hardy 通过自己多年从事数学科研的经验，对数学，文学，哲学，美学等诸多学科的理解，将其写成了一本小册子。给其余的数学工作者，数学爱好者，以及不了解数学的人一个了解数学家内心的机会。

G.H.Hardy（1877 年 2 月 7 日 – 1947 年 12 月 1 日）是一代数论大师，英国数学家，先后在牛津大学（Oxford）和剑桥大学（Cambridge）担任数学教授，与另一位英国数学家 Littlewood 共同研究数学，其研究领域包括解析数论，三角级数，不等式等诸多方向。对数论领域和分析学领域的贡献巨大，是二十世纪英国分析学派的代表人物之一。

  在这平坦的沙滩上，
海洋与大地间，
我该建起或写些什么，
来阻止夜幕的降临?
告诉我神秘的字符，
去喝退那汹涌的波涛，
告诉我时间的城堡，
去规划那更久的白昼。

 倾江海之水，洗不净帝王身上的膏香御气。

1. 《一个数学家的辩白》；
2. 《黎曼猜想漫谈》。

# 一代数学大师 Rota 的经验与忠告

### Ten Lessons I wish I Had Been Taught

#### 讲座（Lecturing）

（a）每次讲座都应该只有一个重点。（Every lecture should make only one main point.）

Every lecture should state one main point and repeat it over and over, like a theme with variations. An audience is like a herd of cows, moving slowly in the direction they are being driven towards. If we make one point, we have a good chance that the audience will take the right direction; if we make several points, then the cows will scatter all over the field. The audience will lose interest and everyone will go back to the thoughts they interrupted in order to come to our lecture.

（b）不要超时。（Never run overtime.）

Running overtime is the one unforgivable error a lecturer can make. After fifty minutes (one micro-century as von Neumann used to say) everybody’s attention will turn elsewhere even if we are trying to prove the Riemann hypothesis. One minute overtime can destroy the best of lectures.

（c）提及听众的成果。（Relate to your audience.）

As you enter the lecture hall, try to spot someone in the audience with whose work you have some familiarity. Quickly rearrange your presentation so as to manage to mention some of that person’s work. In this way, you will guarantee that at least one person will follow with rapt attention, and you will make a friend to boot.

Everyone in the audience has come to listen to your lecture with the secret hope of hearing their work mentioned.

（d）给听众一些值得回忆的东西。（Give them something to take home.）

Most of the time they admit that they have forgotten the subject of the course and all the mathematics I thought I had taught them. However, they will gladly recall some joke, some anecdote, some quirk, some side remark, or some mistake I made.

#### 板书技巧（Blackboard Technique）

（a）开讲前保持黑板干净（Make sure the blackboard is spotless.）

By starting with a spotless blackboard you will subtly convey the impression that the lecture they are about to hear is equally spotless.

（b）从黑板的左上角开始书写（Start writing on the top left-hand corner.

What we write on the blackboard should correspond to what we want an attentive listener to take down in his notebook. It is preferable to write slowly and in a large handwriting, with no abbreviations.

When slides are used instead of the blackboard, the speaker should spend some time explaining each slide, preferably by adding sentences that are inessential, repetitive, or superfluous, so as to allow any member of the audience time to copy our slide. We all fall prey to the illusion that a listener will find the time to read the copy of the slides we hand them after the lecture. This is wishful thinking.

#### 多次公布同样的结果（Publish the Same Result Several Times）

The mathematical community is split into small groups, each one with its own customs, notation, and terminology. It may soon be indispensable to present the same result in several versions, each one accessible to a specific group; the price one might have to pay otherwise is to have our work rediscovered by someone who uses a different language and notation and who will rightly claim it as his own.

#### 说明性的工作反而更有可能被记得（You Are More Likely to Be Remembered by Your Expository Work）

When we think of Hilbert, we think of a few of his great theorems, like his basis theorem. But Hilbert’s name is more often remembered for his work in number theory, his Zahlbericht, his book Foundations of Geometry, and for his text on integral equations.

#### 每个数学家只有少数的招数（Every Mathematician Has Only a Few Tricks）

You admire Erdös’s contributions to mathematics as much as I do, and I felt annoyed when the older mathematician flatly and definitively stated that all of Erdös’s work could be “reduced” to a few tricks which Erdös repeatedly relied on in his proofs. What the number theorist did not realize is that other mathematicians, even the very best, also rely on a few tricks which they use over and over. But on reading the proofs of Hilbert’s striking and deep theorems in invariant theory, it was surprising to verify that Hilbert’s proofs relied on the same few tricks. Even Hilbert had only a few tricks!

#### 别害怕犯错（Do Not Worry about Your Mistakes）

There are two kinds of mistakes. There are fatal mistakes that destroy a theory, but there are also contingent ones, which are useful in testing the stability of a theory.

#### 使用费曼的方法（Use the Feynman Method）

You have to keep a dozen of your favorite problems constantly present in your mind, although by and large they will lay in a dormant state. Every time you hear or read a new trick or a new result, test it against each of your twelve problems to see whether it helps. Every once in a while there will be a hit, and people will say, “How did he do it? He must be a genius!”

#### 不要吝啬你的赞美（Give Lavish Acknowledgments）

I have always felt miffed after reading a paper in which I felt I was not being given proper credit, and it is safe to conjecture that the same happens to everyone else.

#### 写好摘要（Write Informative Introductions）

If we wish our paper to be read, we had better provide our prospective readers with strong motivation to do so. A lengthy introduction, summarizing the history of the subject, giving everybody his due, and perhaps enticingly outlining the content of the paper in a discursive manner, will go some of the way towards getting us a couple of readers.

#### 为老年做好心理准备（Be Prepared for Old Age）

You must realize that after reaching a certain age you are no longer viewed as a person. You become an institution, and you are treated the way institutions are treated. You are expected to behave like a piece of period furniture, an architectural landmark, or an incunabulum.

### Ten Lessons for the Survival of a Mathematics Department

#### 不要在其他系讲自己系同事的坏话（Never wash your dirty linen in public）

Departments of a university are like sovereign states: there is no such thing as charity towards one another.

#### 别越级打报告（Never go above the head of your department）

Your letter will be viewed as evidence of disunity in the rank and file of mathematicians. Human nature being what it is, such a dean or provost is likely to remember an unsolicited letter at budget time, and not very kindly at that.

#### 不要进行领域评价（Never Compare Fields）

You are not alone in believing that your own field is better and more promising than those of your colleagues. We all believe the same about our own fields. But our beliefs cancel each other out. Better keep your mouth shut rather than make yourself obnoxious. And remember, when talking to outsiders, have nothing but praise for your colleagues in all fields, even for those in combinatorics. All public shows of disunity are ultimately harmful to the well-being of mathematics.

#### 别看不起别人使用的数学（Remember that the grocery bill is a piece of mathematics too）

The grocery bill, a computer program, and class field theory are three instances of mathematics. Your opinion that some instances may be better than others is most effectively verbalized when you are asked to vote on a tenure decision. At other times, a careless statement of relative values is more likely to turn potential friends of mathematics into enemies of our field. Believe me, we are going to need all the friends we can get.

#### 善待擅长教学的老师（Do not look down on good teachers）

Mathematics is the greatest undertaking of mankind. All mathematicians know this. Yet many people do not share this view. Consequently, mathematics is not as self-supporting a profession in our society as the exercise of poetry was in medieval Ireland. Most of our income will have to come from teaching, and the more students we teach, the more of our friends we can appoint to our department. Those few colleagues who are successful at teaching undergraduate courses should earn our thanks as well as our respect. It is counterproductive to turn up our noses at those who bring home the dough.

#### 学会推销自己的数学成果（Write expository papers）

When I was in graduate school, one of my teachers told me, “When you write a research paper, you are afraid that your result might already be known; but when you write an expository paper, you discover that nothing is known.”

It is not enough for you (or anyone) to have a good product to sell; you must package it right and advertise it properly. Otherwise you will go out of business.

When an engineer knocks at your door with a mathematical question, you should not try to get rid of him or her as quickly as possible.

#### 不要把提问者拒之门外（Do not show your questioners to the door）

What the engineer wants is to be treated with respect and consideration, like the human being he is, and most of all to be listened to with rapt attention. If you do this, he will be likely to hit upon a clever new idea as he explains the problem to you, and you will get some of the credit.

Listening to engineers and other scientists is our duty. You may even learn some interesting new mathematics while doing so.

#### 联合阵线（View the mathematical community as a United Front）

Grade school teachers, high school teachers, administrators and lobbyists are as much mathematicians as you or Hilbert. It is not up to us to make invidious distinctions. They contribute to the well-being of mathematics as much as or more than you or other mathematicians. They are right in feeling left out by snobbish research mathematicians who do not know on which side their bread is buttered. It is our best interest, as well as the interest of justice, to treat all who deal with mathematics in whatever way as equals. By being united we will increase the probability of our survival.

#### 把科学从不可靠中拯救出来（Attack Flakiness）

Flakiness is nowadays creeping into the sciences like a virus through a computer, and it may be the present threat to our civilization. Mathematics can save the world from the invasion of the flakes by unmasking them and by contributing some hard thinking. You and I know that mathematics is not and will never be flaky, by definition.

This is the biggest chance we have had in a long while to make a lasting contribution to the well-being of Science. Let us not botch it as we did with the few other chances we have had in the past.

#### 善待所有人（Learn when to withdraw）

Let me confess to you something I have told very few others (after all, this message will not get around much): I have written some of the papers I like the most while hiding in a closet. When the going gets rough, we have recourse to a way of salvation that is not available to ordinary mortals: we have that Mighty Fortress that is our Mathematics. This is what makes us mathematicians into very special people. The danger is envy from the rest of the world.

When you meet someone who does not know how to differentiate and integrate, be kind, gentle, understanding. Remember, there are lots of people like that out there, and if we are not careful, they will do away with us, as has happened many times before in history to other Very Special People.

### 参考资料：

1. Rota, Gian-Carlo. “Ten lessons I wish I had been taught.” Indiscrete thoughts. Birkhäuser, Boston, MA, 1997. 195-203.
2. Rota, Gian-Carlo. “Ten Lessons for the Survival of a Mathematics Department.” Indiscrete Thoughts. Birkhäuser, Boston, MA, 1997. 204-208.

# 新加坡首次出现两起新冠病毒死亡病例！

1. 勤洗手，多用肥皂；
2. 每天测量两次体温；
3. 咳嗽或者打喷嚏的时候用纸巾遮住口鼻；
4. 及时处理垃圾和食物，保持桌面整洁；
5. 注意室内通风，保持厕所干净。

# FluxRank: 如何快速地进行机器故障定位

### 贝叶斯网络

1. 如果草已经湿润，求降雨的概率是多少？
2. 如果草已经湿润，求没有降雨且洒水器开启的概率是多少？

$P(R=T,W=T)=P(R=T,S=T,W=T)+P(R=T,S=F,W=T)$

$= P(W=T|R=T,S=T)P(S=T|R=T)P(R=T) + P(W=T|R=T,S=F)P(S=F|R=T)P(R=T)$

$= 0.99*0.01*0.2+0.8*0.99*0.2=0.16038$

$P(W=T)=P(W=T,S=T,R=T)+P(W=T,S=F,R=T)+P(W=T,S=T,R=F)+P(W=T,S=F,R=F)$

$=P(W=T|S=T,R=T)P(S=T|R=T)P(R=T) + P(W=T|S=F,R=T)P(S=F|R=T)P(R=T) + P(W=T|S=T,R=F)P(S=T|R=F)P(R=F)+P(W=T|S=F,R=F)P(S=F|R=F)P(R=F)$

$= 0.99*0.01*0.2+0.8*0.99*0.2+0.9*0.4*0.8+0.0*0.6*0.8=0.44838,$

### FluxRank

FluxRank 这一模块的触发需要服务指标（Service KPI）的异常，因此需要对服务指标（Service KPI）进行异常检测。这里的服务指标通常指的是业务指标，包括某块 APP 的在线人数，某个接口的成功率，某个视频网站的卡顿数等指标。当服务指标出现了异常的时候，就启动 FluxRank 模块进行异常机器定位。

1. 异常检测部分：通过设定阈值或者某个简单的规则来进行异常检测，包括服务的 KPI（Service KPI）和机器的 KPI（machine KPIs）；
2. 手工检查异常的时间段，并且查看在异常的时间段内发生了什么情况；
3. 运维人员根据自身的业务经验来对机器的故障程度做人工排序；
4. 运维人员根据自身的业务经验来对故障进行处理，并且人工给出处理方案。

1. 如何衡量海量 KPIs 的变化程度？在这里不仅有服务的 KPIs，还有机器的 KPIs。而机器的 KPIs 包括内存，硬盘，IO，CPU等诸多固定的指标，那么如何对这些海量的 KPI 曲线进行变化程度的衡量，为后续的指标排序做准备就成为了一个难点；
2. 如何对 KPIs 进行异常性或者重要性的聚类，让运维人员能够一眼看出每个聚簇的差异或者异常程度？
3. 如何对 KPIs 聚类的结果进行排序？

1. 基于 Kenel Density Estimation 用于衡量海量 KPIs 在某一个时间段的变化程度和异常程度；
2. 基于上一步生成的异常程度，对诸多机器所形成的特征使用距离公式或者相似度公式，然后使用 DBSCAN 聚类算法来对机器进行聚类；
3. 在排序部分，对上一步的机器聚类结果进行排序；

#### Change Quantification

1. absolute derivative 方法：个人理解就是对时间序列进行一阶差分操作，然后对一阶差分来做时间序列异常检测，例如 3-sigma 等方法，一旦有明显的变化，就说明当前的时间点出现了突增或者突降；与该方法比较类似的一种方法是：MAD（Median Absolute Deviation）。对于一条时间序列 $X=[x_{1},\cdots,x_{n}]$ 而言，MAD 定义为 $MAD = median_{1\leq i\leq n}(|x_{i}-median(X)|)$，而每个点的异常程度可以定义为：$s_{i}=(x_{i}-median(X))/MAD = (x_{i}-median(X))/median_{1\leq i\leq n}(|x_{i}-median(X)|).$$s_{i}$ 较大或者较小的时候，表示上涨或者下降的异常程度。通过设置相应的阈值，同样可以获得时间序列的异常开始时间。
2. CUSUM 算法也是用于时间序列异常检测的。对于一条时间序列 $X=[x_{1},x_{2},\cdots,x_{n}]$，可以预估它的目标值（target value）$\mu_{0}$，通常可以用均值来估计，也需要计算出这条时间序列的标准差 $\sigma$。通常设定 $\mu_{1}=\mu_{0}+\delta\sigma$$K=\delta\sigma/2=|\mu_{1}-\mu_{0}|/2$。而 Tabular CUSUM 指的是迭代公式 $C_{i}^{+}=\max[0,x_{i}-(\mu_{0}+K)+C_{i-1}^{+}]$$C_{i}^{-}=\max[0,(\mu_{0}-K)-x_{i}+C_{i-1}^{-}]$，初始值是 $C_{0}^{+}=C_{0}^{-}=0$。当累计偏差 $C_{i}^{+}$ 或者 $C_{i}^{-}$ 大于 $H=5\sigma$ 的时候，表示 $x_{i}$ 出现了异常，也就是 out of control。通过这个值，可以获得时间序列开始异常的时间。

#### Change Degree

$P_{o}(\{x_{j}\}|\{x_{i}\}) = \prod_{j=1}^{\ell}P(X\geq x_{j}|\{x_{i}\})$,

$P_{u}(\{x_{j}\}|\{x_{i}\}) = \prod_{j=1}^{\ell}P(X\leq x_{j}|\{x_{i}\})$,

$o=-\frac{1}{\ell}\sum_{j=1}^{\ell}\ln P(X\geq x_{j}|\{x_{i}\})$,

$u =-\frac{1}{\ell}\sum_{j=1}^{\ell}\ln P(X\leq x_{j}|\{x_{i}\})$.

Beta 分布的概率密度函数（probabilisty density function）是 $f(x;\alpha,\beta) = x^{\alpha-1}(1-x)^{\beta-1}/B(\alpha,\beta)$，其中 $B(\alpha,\beta)=\Gamma(\alpha)\Gamma(\beta)/\Gamma(\alpha+\beta)$。在机器 KPIs 中，CPU 等指标可以用 Beta 分布；

#### Digest Distillation

Pearson 系数指的是：$\rho_{X,Y}=\sum_{i=1}^{n}(x_{i}-\overline{x})\cdot(y_{i}-\overline{y})/\sqrt{\sum_{i=1}^{n}(x_{i}-\overline{x})^{2}\cdot\sum_{i=1}^{n}(y_{i}-\overline{y})^{2}},$ 其中 $\overline{x}=\sum_{i=1}^{n}x_{i}/n$$\overline{y}=\sum_{i=1}^{n}y_{i}/n$

Kendall tau 系数指的是：如果 ($x_{i}>x_{j}$$y_{i}>y_{j}$) 或者 ($x_{i}$y_{i})，那么称之为 concordant；如果 ($x_{i}$y_{i}>y_{j}$) 或者 ($x_{i}>x_{j}$$y_{i})，称之为 discordant；如果 $x_{i}=x_{j}$ 或者 $y_{i}=y_{j}$，则既不是 concordant，也不是 discordant。那么 Kendall tau 定义为 $[\text{(number of concordant pairs)}-\text{(number of disordant paris)}] / [n(n-1)/2]$

Spearman 系数指的是：通过原始序列变成秩次变量（rank）（从大到小降序排列即可），$x_{i}$ 将会对应到 $x_{i}'$，后者表示 $x_{i}$ 在从大到小排序之后的序列 $\{x_{i}\}_{1\leq i\leq n}$ 的位置，称之为秩次（rank），得到序列 $X'=[x_{1}',\cdots,x_{n}']$。对原始序列 $Y=[y_{1},\cdots,y_{n}]$ 作同样的操作，得到 $Y'=[y_{1}',\cdots,y_{n}']$。一个相同的值在一列数据中必须有相同的秩次，那么在计算中采用的秩次就是数值在按从大到小排列时所在位置的平均值。如果没有相同的 rank，那么使用公式 $r_{s} = 1-6\sum_{i=1}^{n}d_{i}^{2}/(n(n^{2}-1))$ 进行计算，其中 $d_{i}=x_{i}'-y_{i}'$；如果存在相同的秩次，则对 $X'=[x_{1}',\cdots,x_{n}']$$Y'=[y_{1}',\cdots,y_{n}']$ 来做 Pearson 系数即可，也就是 $\rho_{X',Y'}$

#### Digest Ranking

1. 变化开始时间（change start time）$T_{c}$ 会在失败发生时间 $T_{f}$ 之前；
2. 不同的故障机器 KPIs 的 change start time 是非常接近的；
3. 故障机器的一些 KPIs 的 change degree 是非常大的；
4. 故障机器的占比是与故障原因相关的，故障机器越多说明故障越大；

### 参考资料

1. FluxRank: A Widely-Deployable Framework to Automatically Localizing Root Cause Machines for Software Service Failure Mitigation，Ping Liu，Yu Chen，Xiaohui Nie，Jing Zhu，Shenglin Zhang，Kaixin Sui，Ming Zhang，Dan Pei，ISSRE 2019， Berlin, Germany, Oct 28-31, 2019。
2. Introduction to Statistical Quality Control，6th edition，Douglas C.Montgomery。
3. Bayesian Network：https://en.wikipedia.org/wiki/Bayesian_network

# 在新加坡的这五年—生活篇（五）

NUS 的 Shuttle Bus 是免费给所有人乘坐的，包括老师，学生，外来的工作人员等。除了免费这一个福利之外，NUS 的 Shuttle Bus 也别具特色，学校会将 LOGO 印在 Bus 上，可以让人一眼认出这个是 NUS 的 Bus。而 Bus 的大小是按照线路来分的，通常来说 A1，A2 的车型相对偏大，而 B1，B2，C 车的车型相对偏小，这也是根据是否经过宿舍区，和路线上人数的多少而定的。

NUS Utown 的游泳池虽然没有金沙酒店的游泳池那么高端，但是也是 NUS 的一大亮点之一。UTown 是 NUS 于 2011 年修建的大学城，承担了教学，住宿，学习，娱乐，健身于一身的诸多功能。在 UTown 建成之前，Prince George Park 其实只提供给本科生住宿，而 master 或者 PHD 想住学校宿舍的话，就只能够选择 BoonLay 的宿舍或者 Common Wealth 两处的宿舍。因为宿舍实在是不够用，必须要优先解决本科生的住宿问题。当 UTown 建成了之后，有不少的博士生都选择搬进去，而搬进去的时候，可以选择自己的室友。如果是熟悉的朋友自然是好，如果是没有熟悉的朋友就只能够跟其他陌生人一起居住了，不过就算是陌生人也是 NUS 的学生，因此整体来看也不会出现太大的问题。

UTown 的游泳池就位于 Stephen Ready Centre 的第三层，它对学生免费的。因此只要是 NUS 的教职工，就可以通过证件在开放时间内进入游泳池。一般到了午后或者周末，游泳池里面总是有很多学生在游泳或者晒太阳。相对于 Swimming Pool，这里更像是一个休闲的地方。无论是学生还是老师，觉得科研或者学习疲惫了，就可以来游泳池运动并且放松一下。

UTown 的 Graduate Residence 则是为学生们开设的宿舍区，每个屋子里面有四个小房间，每个房间里面可以住一位学生。四个学生将会共用一个客厅，卫生间，淋浴等公共场所。笔者当年住在 North Tower 的 22 层，通过窗外就可以看到 UTown 的景色。从 PGP 搬到 UTown 的时候应该是 2014-07-15 这个日子，随后笔者就在 UTown 一直住到了博士毕业。不过当时从 PGP 搬过来的时候，论文中的核心部分已经解决，剩下的就只是修修补补的工作，只需要把论文写完即可。于是在博士生第五年的时候，除了日常去 S17 的 Office 之外，其余大部分时间都是在 UTown 度过的。相较于在 PGP 的时光，由于没有了课题的巨大压力，在 UTown 的时光整体来看还是十分舒适和惬意的。（未完待续）

# NUS E-Open House

## NUS 的院系

### Department of Mathematics（数学系）

1. Finding Good Jobs；
2. Wide Range of Career Choices；
3. Multiple Pathways；
4. Myriads of Real World Applications；
5. Life Long Learning Skills。