今年在高考前夕则爆出了各种各样的事情，无论是艺人自爆在高考阶段通过不正当手段获利，还是 XX 省份的多起高考顶替事件，都会让人觉得高考是有一定的灰色地带的。在这些灰色地带，则是通过损害正常考生的合法权益而让靠各种手段投机取巧的考试获得了本不属于自己的利益。通过这些不正当的手段，考生们被迫改变了自己的命运，人生的发展之路无奈地被改变了。对于家庭条件欠佳的考生们而言，在人生发展的重要阶段出现了顶替事件，这样的损失恐怕已经不能够来用金钱衡量了。
这个问题的应用场景十分广泛。例如：对于 Google 主页面而言，同一个账户可能会访问 Google 主页面多次。于是，在诸多的访问流水中，如何计算出 Google 主页面每天被多少个不同的账户访问过就是一个重要的问题。那么对于 Google 这种访问量巨大的网页而言，其实统计出有十亿 的访问量或者十亿零十万的访问量其实是没有太多的区别的，因此，在这种业务场景下，为了节省成本，其实可以只计算出一个大概的值，而没有必要计算出精准的值。
Count-distinct Problem 的维基百科：https://en.wikipedia.org/wiki/Count-distinct_problem
Heule, Stefan, Marc Nunkesser, and Alexander Hall. “HyperLogLog in practice: algorithmic engineering of a state of the art cardinality estimation algorithm.” Proceedings of the 16th International Conference on Extending Database Technology. 2013.
Flajolet, Philippe, et al. “Hyperloglog: the analysis of a near-optimal cardinality estimation algorithm.” 2007.
在上图中，我们可以看到论文中使用的数据都具有某种周期性（Periodicity）。KPI A，B，C 都是具有明显具有工作日和周末特点的，在工作日和周末分别有着不同的形状；KPI D 则是关于网上应用商店周五促销的，因此在周五周六的时候，其实时间序列会出现一个尖峰（peak）；KPI E 的话则是每隔 7 天，会有两个尖刺，然后并且迅速恢复；KPI F 的话则是可以看出时间序列在十一的走势跟其余的时间点明显有区别。除此之外，对于一些做旅游，电商等行业的公司，其节假日效应会更加突出一点，而且不同的业务在节假日的表现其实也是不一样的。有的时间序列在节假日当天可能会上涨（电商销售额），有的时间序列在节假日当天反而会下降（订车票，飞机票的订单量）。因此，在对这些时间序列做异常检测的同时，如何避免其节假日效应就是一个关键的问题了。
从上图可以看到 Period 的核心思路（core idea）。在本文使用的数据中，时间序列的长度较长，一般来说都是好几个月到半年不等，甚至更长的时间。对于一条时间序列（a given KPI），可以将它的历史数据（historical data）进行按天切分，获得多个子序列（sub KPIs）。对于这多个子序列，需要进行聚类以得到不同类别。或者按照日历直接把时间序列的工作日（work day），休息日（off day），春节（spring festival）序列进行切分，将工作日放在一起，休息日放在一起，春节放在一起。把这些子序列进行拼接就可以得到三条时间序列数据，分别是原时间序列的工作日序列（work day subsequence），休息日序列（off day subsequence），春节序列（spring festival subsequence）。然后分别对着三条时间序列训练一个异常检测的模型（例如 Holt-Winters 算法，简写为 HW）。对于新来的时间序列，可以根据当日具体的日期（工作日，休息日或者春节）放入相应的模型进行异常检测，从而进一步地得到最终的结果。
如果有机会的话，其实学校，研究所，工业界帮学生牵线搭桥是非常有必要的，毕竟 NJU 的生源质量整体来看还是非常不错的，有的学生真的只是缺少一个机会而已。在这种时候，如果事先在读书之前，就提前给学生和家长做好一定的职业辅导，是不是也是一种方法呢？下面几幅图来自 NUS 的 2020 E-Open House，化学系的老师在网络上给大家介绍了化学系学生的一些发展方向，其实这样的内容对学生和家长而言可能更有价值和意义。
无论是 NJU 还是 NUS 的学生都是相对优秀的，有的时候给一个转行的机会就能够紧紧地把握住。如果实在是找不到本专业的就业机会，那就只能够找个机会努力转行了。其实，大学最重要的是培养正确的价值观，引导学生们做想做的事情，做喜欢做的事，而不是为了某个目的而把学生的其他路封死。如果一个人真心想做科研，那么他就不会被其他事情所干扰；如果一个人不是真心想做科研，那么他迟早也是要离开的，无论学校是否告诉他一条转行的道路。
时至今日，国内的疫情已经基本稳定，每个省都在走向全面复工的道路，普通的医用口罩其实也不再短缺，无论是网上商店还是线下药店都能够买到口罩。但让人万万没想到的是国外疫情出现了井喷式的增长，从 Google 的疫情统计来看，不少国家的累计确诊人数已经远远超过中国，美国至今已经高达 50 万的确诊病例，甚至还有持续上涨的趋势。疫情刚开始的时候，国外的不少人还说戴口罩没有用，呼吁大家不用戴口罩。虽然笔者也没有直接证据证明戴口罩能够有效地防护，但是为了保险起见，如果买得到口罩，并且能够承受这个经济压力的话，戴口罩其实对个人也没有什么大碍。虽然刚开始的时候不适应，但是戴多了其实也就那么回事。不过戴着口罩思考问题，写代码确实挺累的，但是为了保障身体健康也只能够戴着，别无选择。
每次提到数学这个词，大家能够想到的就是初等代数，平面几何，组合运算，微积分，线性代数，概率论等方向。但在整个数学领域（Earth of Math）上，还有很多更有意思的领域和研究方向，包括数论，几何，拓扑，分形几何，分析，概率统计，博弈论，代数等诸多方向，每一个方向都有很多优秀的数学家在从事相关研究。
当年在数学系的时候，所研究的方向是分形几何（Fractal Geometry）和复动力系统（Complex Dynamics），位于 Earth of Math 的左侧，称之为分形湖泊（Fractal Lakes）。所谓分形，其实是一个粗糙或者零碎的集合形状，可以分成多个部分，且每个部分放大之后与整体有某种相似性，即具有自相似性的性质。而动力系统则是基于某种固定的规则，描述一个空间内的所有点随时间的变化情况，例如钟摆的晃动，水的流动，湖泊里面鱼类的数量。备注：动力系统并不是指汽车的动力系统和发动机引擎，这两者毫无关系。
针对不同的定义域，函数的迭代有着完全不同的研究方法。当时的研究方向是复动力系统（Complex Dynamical Systems）。复动力系统理论的研究始于 1920 年，当时是由数学家 Fatou 和 Julia 研究的，因此复动力系统中的两个重要的集合就是以 Fatou 和 Julia 来命名的，分别称之为 Fatou set 和 Julia Set。随着计算机技术的演进，在上世纪八十年代这些集合可以通过计算机进行可视化，分形几何和复动力系统理论开始蓬勃发展起来。在与双曲几何、分形几何、现代分析学和混沌学等学科发展相互促进的同时，围绕双曲猜想以及 Mandelbrot 集合的研究工作，成为当今复动力系统的研究热点。
举个例子，函数 （）的 Julia 集合的动图如下：
之前在学校研究动力系统的时候，收集过一些书籍，在此列举给大家，希望对初学者有一定的帮助。One Dimensional Real and Complex Dynamics（实与复动力系统）需要学习的资料如下：
如果是在 NUS 的 IMS（Institute for Mathematical Sciences）举办的学术会议，一般来说只要是在校的研究生都是可以参加的。记得当时参加的第一个学术会议是关于 PDE 的，标题叫做 Hyperbolic Conservation Laws and Kinetic Equations：Theory, Computation, and Applications（1 November – 19 December 2010）。笔者去听这个系列讲座是因为在 2010 年选择了一门 PDE 的研究生课程，而这个讲座则是作为课程的一部分。
笔者参与的另外一个学术会议则是关于动力系统的，标题叫做 Workshop on Non-uniformly Hyperbolic and Neural One-dimensional Dynamics（23 – 27 April 2012），主要是关于非一致双曲动力系统方向的研讨会。笔者记得当时所修的课程应该只有概率论（Probability II）一门课，因此上课的任务不算很重。参会的时间恰好是学期快结束的时候，科研的任务也不算特别繁重。因此，积极参与各种学术会议也算是科研的其中一部分，一来通过参会可以了解当前的学术研究情况，二来可以认识学术界的各种人士，也算是扩大学术交流圈子的好机会。
从数学家族谱（Mathematics Genealogy Project）上面可以看到：Gian-Carlo Rota 的导师是 Jacob T. Schwartz，Rota 于 1956 年在耶鲁大学获得数学博士学位，其博士论文的题目是 Extension Theory of Differential Operators。
在 1997 年，Rota 发表了两篇关于人生经验和忠告的文章，分别是 “Ten Lessons I wish I Had Been Taught” 和 “Ten Lessons for the Survival of a Mathematics Department“。下面就来逐一分享这两篇文章中的一些观点。
Ten Lessons I wish I Had Been Taught
（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.
（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 Erdö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 Erdös’s work could be “reduced” to a few tricks which Erdö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.
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.
Rota, Gian-Carlo. “Ten lessons I wish I had been taught.” Indiscrete thoughts. Birkhäuser, Boston, MA, 1997. 195-203.
Rota, Gian-Carlo. “Ten Lessons for the Survival of a Mathematics Department.” Indiscrete Thoughts. Birkhäuser, Boston, MA, 1997. 204-208.