Samuel's Blog

Snippets of life of a programmer

List

Lists provide one natural implementation of stacks, and are the data structure of choice in many places where flexible representation of variable amount of data is wanted.

Read more »

Rendering

Shading

$$
I = I_ak_a + \sum_i I_ik_d(L_i \cdot N) + \sum_iI_ik_s(R_i\cdot V)^n
$$

Ambient illumination

In computer graphics, ambient illumination is a lighting model that simulates the way light is reflected off of objects and fills a scene. It is called “ambient” because it is meant to represent the indirect light in a scene that comes from all directions, rather than from a specific light source.

In other words, ambient illumination is the base level of lighting in a scene that fills in the shadows and gives objects a sense of overall brightness. It is typically implemented as a low-intensity, uniform light that is applied to all objects in a scene.

The ambient terms models indirect illumination; the light coming from other surfaces rather than directly from the light sources. The parameter $k_a$ controls what portion of ambient light the surface reflects and the $I_a$ in the global intensity of the ambient light

Diffuse shading

In computer graphics, diffuse shading is a technique used to simulate the way light is scattered and absorbed by an object’s surface. It is based on the idea that light is absorbed and scattered in all directions by a rough surface, such as a matte paint finish.

Diffuse shading is typically implemented using the Phong lighting model, which calculates the intensity of the diffuse reflection for each pixel on an object’s surface based on the angle between the surface normal (a vector perpendicular to the surface) and the light source.

The diffuse term models Lambertian reflection where the incoming light in reflected uniformly in all directions. The paramter $k_d$ controls the amount of light that is reflected in a diffuse manner. Scalar $I_i$ describes the intensity of the incoming light

Imperfect specular reflection

In computer graphics, imperfect specular reflection is a technique used to simulate the way light is reflected off of an object’s surface in a more realistic manner. It is based on the idea that the reflection of light off of an object’s surface is not always perfect and that there are often small imperfections or irregularities that can affect the reflection.

The specular term models imperfect mirror-like reflection, in which the reflected light is distributed around the direction of reflection $R_i$. The paramter $K_s$ controls the amount of light that is reflected in a specular manner. The paramter $n$ models the shape of that distribution; high $n$ will result in tighter distribution and the behaviour that is closer to a perfect mirror light reflection. Scalar $I_i$ describes the intensity of the incoming light

Read more »

Axiom

An axiom, postulate, or assumption is a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. [1]

Lemma

In mathematics, informal logic and argument mapping, a lemma (plural lemmas or lemmata) is a generally minor, proven proposition which is used as a stepping stone to a larger result. For that reason, it is also known as a “helping theorem” or an “auxiliary theorem”.[2]

Proposition

A proposition is a statement that is either true or false. In our course, we will usually call a mathematical proposition a theorem. A theorem is a main result. A proposition that is mainly of interest to prove a larger theorem is called a lemma. Some intermediate results are called propositions. Finally, a corollary is a statement that follows easily from a theorem. [3]

Acknowledgements

[1]: https://en.wikipedia.org/wiki/Axiom
[2]: https://en.wikipedia.org/wiki/Lemma_(mathematics)#:~:text=In%20mathematics%2C%20informal%20logic%20and,or%20an%20%22auxiliary%20theorem%22.
[3]: http://math.northwestern.edu/~clark/285/handouts/abs-math.pdf

High bias and Variance

High Bias

  • Underfitting the training set
  • Training set performance similar to development set performance

High variance

  • Overfitting the training set
  • Training set performance superior than development set performance
Read more »

引言

翻译自 《The New Turing Omnimbus》Chapter 4 Paragraph 1

为了了解组成现代世界的许多系统,我们越来越多转向计算机模拟。系统,无论是非人为的或者人工的,总是有许多部分有着复杂的行为,使得唯一可行的的模拟这种行为的方法为假设它是随机的. 显而易见的是,咱们可以利用更简单的,符合统计学定律的部分替代这些系统中复杂的部分。

举个例子,如果我们想要模拟一场两边实力平均的排球比赛,我们可以通过抛硬币的方法来建立一个简单的模型:如果一个队伍正在发球,抛硬币的结果属于是不利于他们的那一面,则另一个队伍加一分且轮到他们发球;否则,这个发球队伍加一分并且继续发球。这个抛硬币的过程让我们想起了一个简单的打赌方式 ——蒙特卡洛

Read more »

Key formulae Explanation Example formulae Representation
\limits_a^b Setting limits for the integral $\int\limits_a^b {1\over 1+x^2}dx$ $\int\limits_a^b {1\over 1+x^2}dx$
\\ start a new line $1=1\\2=2$ $1=1$
$2=2$
\frac{a}{b} Fraction $\frac{-b\pm \sqrt{b^2-4ac}}{2a}$ $\frac{-b\pm \sqrt{b^2-4ac}}{2a}$
\times The multiplication sign $a \times b$ $a \times b$
\div The division sign $a \div b$ $a \div b$
\text{} Allows for text with space $\text{Hello World!}$ $\text{Hello World!}$
\hat{} The hat accent $\hat{y}$ $\hat{y}$
\partial{} The partial derivative sign $\frac{\partial}{\partial \theta_j}$ $\frac{\partial}{\partial \theta_j}$