2010年3月25日 星期四

[學習] Implicit function theorem

還有一個強大的定理 Implicit function theorem
基本上就是想知道 dy/dx 但是所有的關係都是透過另一個函數連在一起的
所以有人就很聰明的發展這個定理
就算兩個變數是沒有直接相關連的
我們也可以很快知道彼此對應的影響
推導的內容也只是用到簡單的chain rule而已
但是卻真的滿好用得
記錄一下

http://en.wikipedia.org/wiki/Implicit_function_theorem

[學習] Envelope theorem

記錄一下寫作業的時候用到的兩個定理:
Envelope theorem:
當面對 min f(x,r)
想知道單一變數偏微的效果時可以使用(以外為引用沒有限制的情況下)

Consider an arbitrary maximization (or minimization) problem where the objective function f(x,r) depends on some parameters r:

f^*(\bold r) = \max_{\bold x} f(\bold x,\bold r)\,

The function f *(r) is the problem's optimal-value function — it gives the maximized (or minimized) value of the objective function f(x,r)as a function of its parameters r.

Let x*(r) be the (arg max) value of x, expressed in terms of the parameters, that solves the optimisation problem, so that f*(r)=f(x*(r),r). The envelope theorem tells us how f*(r) changes as a parameter changes, namely:

\frac{d\ f^*(\bold r)}{d\ r_i} =  \frac{\partial f(\bold x,\bold r)}{ \partial r_i} \Bigg|_{\bold x = \bold x^*(\bold r)}

That is, the derivative of f*(r) with respect to ri is given by the partial derivative of f(x,r) with respect to ri, holding x fixed, and then evaluating at the optimal choice x=x*(r).

http://en.wikipedia.org/wiki/Envelope_theorem
應該是要求 f is twice differentiable continuous function.

2010年3月20日 星期六

[學習] NP hard & NPComplete

最近有人問什麼是NP 什麼是NPComplete
就順便查了一下清楚的定義
簡單的說,
NP hard的問題就是沒有辦法找到Polynomial的演算法來解決此問題
但是在NP hard的問題中又可以分成 NP Complete 跟 Weakly NP
原因是演算法複雜度包含了兩個部分
一個是演算法迭代的operation次數
一個是演算法的digits 次數
如果兩個都是NP的話,就是NP Complete
如果演算法是Polynomial的話,但是digit有可能會爆掉
就是weakly NP

參考:
http://en.wikipedia.org/wiki/Weakly_NP-complete
http://en.wikipedia.org/wiki/NP-complete

2010年3月18日 星期四

[研究] 興趣

最近在思索自己真正感興趣的方向是什麼
有些人可以很輕易找到自己喜歡的
我則是一直在思考這個問題
要找到有熱情的領域
因為影響深遠的一個決定

但是這個真的不是一個容易的決定
在思考的過程反反覆覆
還要兼顧自己的能力還有時機
總之要好好思考加油才行~~

2010年3月4日 星期四

[研究] Latex Editor

最近在用latex的時候想到朋友用的軟體可以即時顯示結果
所以就問了一下來試試看
畢竟Windet已經用了一段時間
找類似的軟體又可以提供所見即所得的效果較好
所以就試了這個 Latex Editor (LEd) http://www.latexeditor.org/index.html
他提供了內建的embedded dvi viewer
當compile成dvi後可以在旁邊看到編輯時的狀況
相對來說比之前全文書介面來的方便許多
唯一要注意的就是針對 Mitex 2.7要選正確的dll連接
還有看dvi重點的 Ghostscript 不能選太新的版本
我用最新的版本都看不到eps圖片
但是用 gs854w32.exe 就可以解決這個問題了
有興趣的朋友也可以參考看看

2010年2月19日 星期五

[遊記] Muir Woods National Monuments



因為薏棻的妹妹們過來這邊
由於他們自助多半都是在城市逛
我們就想說去戶外走走散心也不錯
這時候想起上學期Ellen說這邊有些國家公園不錯
就決定星期六的時候去國家公園走走

上網查了一下發現這個國家公園還滿近的
而且評價也還不錯就決定去了這個Muir Woods 國家公園
當天天氣還不錯,一路上風景也很好
一邊走一邊拍照,心情也開心了起來
每次開學就被行程還有計畫壓的累死了
真的需要轉移一下注意力

還記得在ohio的時候還可以常常照相
不知不覺就可以抒解壓力
這邊一個不小心就弄作業弄不完了...
還是要多照照相才行...這次照相的時候都有一點生疏快門光圈設定了
我們在入口的地方照相
走在步道上,真的有進入森林的感覺
真的很難想像這邊之前原本是沒有樹木的



一開始還一邊走一邊看路線,入口處隨便照了一張
剛好是山谷中陽光從上面照下來的樣子,
感覺有一種老天爺給予的恩澤照下來的感覺(好啦...應該是我想太多了)
還有大大的年輪跟高高的樹木
魔戒裡面的樹人應該就是這樣高大的吧
如果它忽然動起來我應該會很害怕~~
走一走會覺得自己好渺小喔
面對大自然的時候,人類的渺小就自然地顯露了
很多煩惱也因為這樣一趟而散開了許多 (雖然之後趕作業時又回來了)



去一個地方重要的是什麼呢?
當然是gift shop阿~~
到了 gift shop時外面有好幾隻大大的熊...
讓我想到黃金羅盤裡面小孩子騎熊的樣子...嘿嘿嘿
就給他騎上去了~~看起來還有模有樣的



總歸來說,這是個讓人散心的好地方~~
希望新的一年
生活可以不要那麼忙碌
有機會多多散散心走一走~~

[統計] PK formula (Pollaczek–Khinchine formula)

cite: http://en.wikipedia.org/wiki/Pollaczek%E2%80%93Khinchine_formula

PK formula for M/G/1 queue
可以看到只要moment fitted
我們就可以預期得到一樣的 long term waiting time
不過問題是
我們怎麼知道真實世界的moment是怎樣呢?

Pollaczek–Khinchine formula

From Wikipedia, the free encyclopedia

Jump to: navigation, search

The Pollaczek-Khinchine formula is used in queuing theory to determine the mean time spent waiting in the queue to be serviced (the queuing delay) and the mean end-to-end time through the system. The formula is applicable in a single server situation with arrivals distributed according to a Poisson distribution and a general service time distribution. [Known as a M/G/1 system in Kendall's notation.] The formula was developed by Felix Pollaczek and Aleksandr Khinchin.

[edit] Formula

The formula states that the mean queuing delay is given by:
F_q=\frac{1}{\lambda_s}\times \frac{\rho}{1-\rho}\times\frac{1+C_s^2}{2}
The average time in the system, F, is given by:
F=F_q+\frac{1}{\lambda_s}
In the above equations, the variables are defined as:
λs=rate of service
λa=rate of arrival
\rho=\frac{\lambda_a}{\lambda_s}, which is called "traffic intensity," ranges between 0 and 1, and is the mean fraction of time that the server is busy. [If the arrival rate λa is greater than or equal to the service rate λs, the queuing delay becomes infinite.]
Cs is the coefficient of variation of the service time (the ratio of its standard deviation to its mean). This equals σsλs, where σs is the standard deviation of the service time, as the mean service time is 1/λs. Cs = 0 when service times are constant, and Cs = 1 when service times follow an Exponential distribution.

[edit] Examples

If ρ equals 0.5, that is the server is busy 50% of the time, and Cs = 1, then
F_q=\frac{1}{\lambda_s}\times \frac{\rho}{1-\rho}\times\frac{1+C_s^2}{2}
F_q=\frac{1}{\lambda_s}\times \frac{0.5}{0.5}\times\frac{1+1}{2}
F_q=\frac{1}{\lambda_s}
That is, when the server is busy only half the time, the mean queuing time equals the mean service time. That may help explain the long wait at the post office!

As ρ increases, the mean queuing time increases rapidly. If the server is 90% utilized, then the mean queuing delay is nine times the mean service time.

Note that, if the service time is always the same (Cs = 0), then the mean queuing delay is half what it would be if the service time were exponentially distributed (Cs = 1).