摘要:
问题1:给定离散随机变量 x 均匀分布在区间 [a, b] 的整点上,y 均匀分布在区间 [c, d] 的整点上,求期望 E(|x-y|)。问题很简单,显然最直接的办法就是枚举 x 和 y 然后进行统计即可。如果再稍稍思考一下,那么可以发现其实只用枚举其中一个变量就行了,因为若固定 x = i,那么求 E(|i-y|) 只需要对i =y 和i y 两种情况分别进行讨论即可。上面两个方法的运行时间都是与区间的大小相关的,对于这样简单的一个问题,有理由相信一定有 O(1) 的方法存在,事实上也的确如此,推导如下。首先可以交换 x , y 的顺序以保证 a = c,那么 a, b, c, d 阅读全文
摘要:
Simplicity is relative. To the great majority of mankind– mathematical ignoramuses – it is a simple fact, for instance, that 17 X 17= 289, and a complicated one that in a principal ideal ring a finite subset of a set E suffices to generate the ideal generated by E. For the reader and for others amon 阅读全文
摘要:
立体涂鸦(3D Street Painting, 3D Chalk Art, 3D Graffiti...)是一种很有意思的东西。前些年在网上经常能看到国外玩家的作品,比如这里;最近也有些国内的作品出现,比如这里。这玩意的原理其实很简单,比如前几天就有牛人写了一篇教程。我以前也尝试弄过,不过我对3d max不是很熟,也没有数码相机,没有他搞得那么专业,就是先渲染一张图,然后用light的projector map打在一个平面上,看起来效果也还不错。当然,如果不借助于3d max这样的软件,自己写个程序直接渲染出立体涂鸦的草图也并不是件难事。比如有一个模型o,放在一张纸p上,摄像机的位置为c,那 阅读全文
摘要:
Screen Space Soft Shadows (SSSS) 是 GPU Pro 中的一篇文章,我感兴趣已经很久了。可是 GPU Pro 太贵,而 ShaderX 系列的书国内向来也都没有引进,因此像我这样的穷人,自然是买不起了。所幸后来 AK Peters 放出了 GPU Pro 随书光盘的下载,正好在其中有关于 Screen Space Soft Shadows 的一份简要文档,这才得以一... 阅读全文
摘要:
People who play with bits should expect to get bitten.-- Jurg NievergeltI failed math twice, never fully grasping probability theory. I mean, first off, who cares if you pick a black ball or a white b... 阅读全文
摘要:
When bitwise operations are combined with addition, subtraction, multiplication, and/or shifting, extremely intricate results can arise, even when the formulas are quite short. -- Donald E. Knuth [TAo... 阅读全文