走在雪后天晴的路上,子轩盯着地上被踩实的雪,想着下一步要不要踏在上面。

子轩穿的是运动鞋。鞋不是很厚,所以他总想着跺两脚,好像这样能让他暖和多少似的。除了跺两脚,他还想喝一杯热可可。其实喝热咖啡也没问题,但咖啡冲出来都是热的,所以子轩会说“我想喝热咖啡”而不是“我想喝热咖啡”。少了一个热字,就好象不是为了保暖而喝的了。语感很重要。

而且热可可甜。好喝。星冰乐也甜,也好喝,但是星冰乐是冰的。子轩想到这里,又跺了两下脚。

不过虽然子轩想着喝热咖啡,错了,热可可,热可可,想喝热可可(其实都可以喝,但主要是想喝热可可)。但他向前的脚步里却还是没有半点迟疑。倒不是因为前方有一家地标性的 58 年建的老牌咖啡店,在里面可以喝到可绕地球一圈的热可可;也不是因为前面有一家超市,超市里有卖可可粉,可以买一袋带回家去烧开水冲一杯。单纯是因为他没那么想喝。因为子轩不清楚附近的店铺,他需要掏出手机,在寒风中哆嗦着手搜索咖啡厅,然后还要在寒风中握着手机导航。总而言之就是很要命。如果碰巧路过一家就进去买一杯吧,子轩心想。

边想着,子轩路过了一个垃圾桶,不经意中瞟了一眼,他发现里面有一个咖啡杯。他一眼就看出来,这个杯子来自他不怎么去的斯达巴克斯。子轩想着这样读很搞笑,于是又来了一遍。斯——达——巴——克——斯——。他不小心笑了出来,嘴里冒出了一小团白雾。

子轩看了看周围,确认身边没有人。

子轩其实也想过和他人一起喝热可可的事。不过单纯是想想。

他想过,在某一个夏天的午后,已经停业的咖啡厅,和她喝着小卖部买来的柠檬汽水。

“好无聊啊。”

“嗯。”

然后只剩下无休止的蝉鸣。

子轩又四下张望。映在眼里的尽是雪。他拉紧了背包的肩带,又跺了两下脚,好像在确认脚下踩的是否还是冰。

他抬头一望,茫茫的天空已经透出了夜色。

“下次再喝吧。”他对自己说,现在他想的只是吃一顿好的晚饭。

Comment and share

rec-4-12-2018

in life

Artificial Intelligence

Resolution

If li¬mjl_i \Leftrightarrow \neg m_j, then:

l1lk    m1mnl1li1li+1lkm1mj1mj+1mn\frac{l_1 \vee \cdots l_k \ \ \ \ m_1 \vee \cdots \vee m_n}{l_1 \vee \cdots \vee l_{i-1} \vee l_{i+1} \cdots \vee l_k \vee m_1 \vee \cdots \vee m_{j-1} \vee m_{j+1} \cdots \vee m_n}

If there is a empty clause after a resolution, it means there are conflicts.

p   ¬p\frac{p\ \ \ \neg p}{\square}

Resolution algorithm to prove α\alpha within KB:

  1. Generate CNF of the knowledge base KB¬αKB\wedge\neg\alpha
    • CNF: (l1,1l1,2l1,n1)(l2,1l2,n2)(lm,1lm,nm)(l_{1,1}\vee l_{1,2} \vee \cdots \vee l_{1,n_1}) \wedge (l_{2,1}\vee \cdots \vee l_{2,n_2})\vee\cdots \vee (l_{m,1}\vee\cdots\vee l_{m,n_m})
    • Also called k-CNF if n1=n2==nm=kn_1 = n_2 = \cdots = n_m = k
  2. Repeat resolution process for every new rule
    1. If there is no new rule, α\alpha cannot be proved.
    2. If there is an empty literal, then stop and α\alpha is proved

Complexity: exponential

Expressiveness: better (not restricted to Horn clauses)

Propositional logic

Jargons

Use functions, predicates to represent relationships:

  • A is a person -> Person(A)Person(A), Person: predicate
  • Person a has a crippled left leg -> Crippled(LeftLegOf(a))Crippled(LeftLegOf(a)), LeftLegOf: function (it’s OK since a human has only one left leg) Formally,

Term ::= Function ( Term {, Term}* ) AtomicSentence ::= predicate ( Term {, Term}* ) …

Model

Forgot that.

Networking

Cisco’s proprietary software, packettracer, couldn’t be downloaded without enrolling in its network course.

IOS

  • use enable to enable the thing
  • show interfaces to have a look at all interfaces, show interface [interface].
  • show vlan to show vlan
  • configure terminal to open the configuration in terminal
  • (config) interface [interface] to select an interface

Dynamic Trunking Protocol

A proprietary protocol invented by Cisco to negotiate trunking on a link between two VLAN-aware switches.

There is several modes for it:

  • access: puts the ethernet port into non-trunking mode and negotiates to convert the link to a nontrunk one, disregarding the neigboring port
  • trunk: puts the ethernet port into trunking mode and negotiates to convert the link to a trunk one, disregarding the neigboring port
  • dynamic auto: willing to trunk, will be trunk if the neighboring port is dynamic desirable or trunk
  • dynamic desirable: actively willing to trunk
  • nonegotiate: disable DTP. No wonder, it is not compatible with dynamic modes.

Except nonegotiate, all modes are triggered by (config-if) switchport mode [mode]. Switch to no-negotiate mode using (config-if) switchport nonegotiate.

Use a no before the statement to do the opposite thing, like:

(config-if) no shutdown: set up the link (config-if) no switchport nonegotiate: turn on DTP

Computer Graphics

Blurring is often used in computer graphics, like, to create HDR(high dynamic range) bloom, depth of field or other post process effects.

HDR bloom: since the real-world camera cannot focus perfectly, so it will convolve the incoming image with an Airy disk. What about the Airy disk? Know what a spot of light looks like in our eyes? That would be one. A perfect lens with a circular aperture would make it because the diffraction of light.

This effect is not noticeable when it is not so bright. However, with more light we can see the blurred edge of the bright part of the image, taken by a camera. And computer graphics tries to reproduce the same effect by blurring.

You can think up an approach instantly: take the average of neighboring blocks, like below:

[1/91/91/91/91/91/91/91/91/9]\begin{bmatrix} 1/9&1/9&1/9 \\\\ 1/9&1/9&1/9 \\\\ 1/9&1/9&1/9 \\\\ \end{bmatrix}

By all means this is bad. It will seem block-ish.

A better one is Gaussian blur. It uses the Gaussian distribution as the weight of neighboring pixels to calculate the average, or more accurately, do the convolution. The weight matrix, like the one above, is called kernel.

A 3x3 Gaussian kernel is like:

[1/161/81/161/81/41/81/161/81/16]\begin{bmatrix} 1/16 & 1/8 & 1/16 \\\\ 1/8 & 1/4 & 1/8 \\\\ 1/16 & 1/8 & 1/16 \\\\ \end{bmatrix}

Some other kernels are here.

It also can be used before downsampling: Gaussian blur gets rid of the sharp edges in the image, thus after downsampling, it will free the image from aliasing like moire patterns. Aliasing happens because of the poor sampling makes different signals indistinguishable, and some high frequency signals might get in the way after sampling. So a low pass filter need to be applied before sampling.

Task: sample => downscale image Reason of problem: high freq. signal => ? Problem: aliasing => moire pattern Solution: low pass filter => blurring

And yes, Gaussian blur is also a low pass filter, with a Bode plot like a parabola. Possibly it seems obvious at first sight: Gaussian distribution has a factor ex2+y22σ2e^{-\frac{x^2+y^2}{2\sigma^2}}, which is stable through Fourier transforms.

We can calculate it out. Let’s put the basic calculus into practice.

eiωxex2+y22σ22πσ2 dxdy=e2σ2ω2e(x2σ2ωi)2+y22σ22πσ2 dxdy=e2σ2ω2\begin{aligned} &\iint e^{i\omega x}\cdot\frac{e^{-\frac{x^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\\ =&e^{-2\sigma^2\omega^2}\iint \frac{e^{-\frac{(x-2\sigma^2\omega i)^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\\ =&e^{-2\sigma^2\omega^2} \end{aligned}

So the amplification is:

dB=20loge2σ2ω2=40ln10σ2ω2\begin{aligned} dB&=20\log{e^{-2\sigma^2\omega^2}}\\ &=-\frac{40}{\ln 10}\cdot \sigma^2\omega^2 \end{aligned}

Perfect! It is a parabola after all.

Leave Kawase to the next day.

Misc

マシンガンでも壊せなくて キャタピラーでも潰せなくて

Comment and share

1984

Ignorance is strength.

高中买的书,终于在现在看完了。

我觉得这从一个侧面反映了在大学我的文化生活的严重缺失。

这就很糟糕。


这是在二战结束后不久的事。

世界分为三股力量:Eurasia, Eastasia 和Oceania。

三巨头之间爆发了核战争,这场战争使得生灵涂炭。在互相造成了巨大损失之后,达成和解。

一个反乌托邦的世界就开始了它的运转。

以上都是胡扯。都是编造出来的故事。

同意以上叙述的你的想法十分危险。可能需要跟我来Ministry of Love一趟。


看起来好像和发条橙很像,不过还是有点不同。

其实我就在这里胡说,反正在和Eastasia联手和Eurasia宣战的时候这篇文章会被修改或者删除的。

不用担心。

Big Brother包揽一切。

Comment and share

  • page 1 of 1
Author's picture

NoirGif

A progamer.

(click me to see some )


Student(probably)