工具与资源github.com
用代码形式呈现的数学符号速查表
A cheat-sheet for mathematical notation in code form
2015 — 2021,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 GitHub 上的 math-as-code 项目:用代码示例解释常见数学记号,帮助有编程背景的人读懂公式。它把求和、乘积、集合、逻辑等符号对应到熟悉的代码写法。评论区还讨论了数学记号作为语言障碍、形式化操作的价值,以及补充函数式写法的建议。
为什么经久不衰:它把数学记号翻译成程序员熟悉的代码,降低了读公式的门槛,因此多年反复被需要。
HN 评论精选
数学难往往难在记号与教学语言,编程可以成为替代入口。
很棒的尝试。我是为了职业发展不得不硬着头皮学数学的人。上学时我需要额外辅导,但其他科目都没什么困难。我曾以为自己太笨学不了数学,后来意识到问题不在数学概念本身——这些概念其实相当容易——而在于数学的语言和教学方式。编程尤其帮我学会了数学;摆脱传统记号与教学方式来重新表述,确实帮到了我。
DaedPsyker查看英文原文
Fantastic endeavour. I'm someone who has needed to force myself in mathematics for my career. I needed extra help at school, but had no real trouble in any other class. I thought I was just too dumb for maths. I came to realise that my problem was not in mathematical concepts which it turns out are fairly easy, but in the language of maths itself and how it is taught (some exceptions such as Strang who is just a wonderful educator). Programming in particular really helped me to learn. That's not to say that certain areas aren't still difficult but reformulating away from the traditional notation and teaching style has helped me.
建议补充 fold 等函数式表达,而不只是命令式循环。
如果能加入一些函数式模式会更好。比如求和与乘积也是 fold,但文中只有命令式示例。下面这种写法会很有帮助:foldr (*) 1 [1..6];而文中展示的是 var value = 1; for (...) { value *= i }。
maweki查看英文原文
Some functional patterns would be nice as well. Like summation and product are also folds and there are only imperative examples. This would be helpful as well: foldr (*) 1 [1..6] while this is the shown pattern: var value = 1 for (var i = 1; i <= 6; i++) { value *= i }
记号利于形式推导,但常被滥用来压缩文本、损害可读性。
数学记号非常擅长促进形式化操作,这是它的关键特性,没有它我们就会停留在古代数学的水平。这也是它几百年前被发明出来的原因。话虽如此,我发现记号在文本中常被滥用,沦为普通人类语言的替代品;它虽然压缩了文本,却无助于读者更好地理解在说什么,反而像一堆混乱的字符和符号,字体、样式、大小各异,似乎只会让人眼睛疲劳。
Koshkin查看英文原文
Mathematical notation is great at facilitating formal manipulations. This is its critical feature, and without it we would get stuck at the level of ancient mathematics. This is the reason it was invented a few hundred years ago in the first place. That said, I find that notation is often abused in texts as a mere substitute for the normal human language which, while allowing to compress the text, does in fact nothing to help the reader better understand what is being said but rather looks like a crazy mess of characters and other marks in a multitude of fonts, styles and sizes the only purpose of which seems to be to cause an eye strain.
推荐《The Little Typer》展示类型、证明与程序的联系,并展望依赖类型。
如果你想找一本连接数学与代码的好书,强烈推荐《The Little Typer》。它从介绍 Pi(一种带有限制递归、类型可带值等特性的 Lisp)开始,逐步构建出大小编码在类型里的向量等东西;然后说明相等性也是一种类型,该类型的值就是证明。许多证明可以看作操作数据结构以得到某个类型的值。我也好奇还要多久才会出现主流语言支持 pi 类型。
_hardwaregeek查看英文原文
I highly recommend reading The Little Typer if you want a great book that bridges math and code. It starts out describing Pi, a Lisp with some interesting restrictions (limited recursion, types can have values, etc.). They build up some cool stuff like vectors with the size encoded in the type. All of a sudden, they explain that equality is a type, and any value of said type is a proof! Turns out you can think of many proofs as manipulating data structures to get a value of a certain type. I wonder how long until we get a somewhat mainstream language with pi types. I know Rust considered adding them. And I recently learned that Rust does allow for quantification over lifetimes^[1]. I could certainly see a language that implements dependently typed arrays. Midori for instance looked into eliding bounds checks with compiler proofs^[2]. [1]: https://doc.rust-lang.org/beta/nomicon/hrtb.html [2]: http://joeduffyblog.com/2016/02/07/the-error-model/
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com