2014年1月20日 星期一

[分享] LaTeX + TeXworks 簡潔安裝 (for windows / mac)

這次要跟大家分享的是如何簡潔安裝 LaTeX 注意,此篇不會介紹任何 LaTeX 語法,需要查詢語法請至

---
以下我們開始進入正題,個人覺得最簡便又快速的方法如下:

1. 首先下載 TeXworks ( 完全免費的 LaTeX 編輯軟體 for windows / mac / Linux)
https://code.google.com/p/texworks/
(目前最新版本for windows 是 TeXworks 0.6.0 (Get it )




2. 再來 去下載一個任何一個可以執行的 LATEX 範本 ( *.tex 檔案)
這邊以IEEE 提供的會議論文LATEX範本 為例,將下面兩個檔案下載並放置在同一個資料夾

其中: sample.tex是LATEX專用檔、ieeeconf.cls是IEEE會議論文的格式檔 此兩個檔案須放在同一個資料夾。


3. 之後執行TeXworks 並載入之前步驟2中下載的 sample.tex 按執行 (下圖綠色撥放按鈕)


此時正常來說會跳出錯誤訊息,照著錯誤訊息去點擊連結,並下載需要的 MiKTex 後安裝
MiKTex: http://www.miktex.org/

4. 接著重新開啟 TeXworks 並再次讀取sample.tex此時若前述步驟3安裝成功,則可回到步驟2 (按下綠色播放按鈕執行);即可發現TeXworks可以正常編譯,並成功的將LaTeX 編碼轉換成pdf檔案。至此便完成整個安裝作業。



2014年1月16日 星期四

[衍生商品] 遠期合約 與 期貨 的異同

這次要介紹 遠期契約(Forward contract) 與 期貨契約(Futures) 之間的異同

其實此兩者本質上非常相近,不過我們可以將 遠期合約 看成可以客製化的 期貨契約 就會比較容易理解。其兩者特色列舉如下表

遠期契約的特色

  1. 在場外市場 (Over The Counter, OTC) 交易
  2. 為買賣雙方的私人交易合約 => 流動性差 & 存在 違約風險(Default risk)
  3. 非標準化合約 =>客製化
  4. 可隨時到期
  5. 在合約終止的時候才結算
  6. 可能附加抵押品(collateralization)

期貨的特色

  1. 在交易所(Exchange)交易 => 無違約風險 & 流動性較佳
  2. 標準化合約 
  3. 到期時間固定
  4. 每日結算(逐日盯市 Marking to Market)
  5. 保證金制度(Margin)
延伸閱讀:
[衍生商品] 期貨的基差風險 (Basis Risk)

ref: John C. Hull, Options, Futures and Other Derivatives 7th.

2014年1月14日 星期二

[演算法] 平方收斂與超線性收斂

這次要介紹演算法中的兩種收斂速度 (Speed of convergence):
  1. 平方收斂 (Quadratic Convergence)
  2. 超線性收斂 (Superlinear Convergence)
首先介紹 Quadratic Convergence 定義:

===========================
Definition: (Quadratic Convergence)
一個演算法被稱作是 具有二次收斂(Quadratically Convergent) 如果下列條件成立:
若將此演算法應用到二階型態的成本函數 $J: \mathbb{R}^n \rightarrow \mathbb{R}$:
\[
J(u) = u^T A u + b^T u + c, \ A \succ 0
\]其最佳解可以在 $n$ 步或者少於 $n$ 步之內被求得。
===========================

Comments:
1. 最陡坡度法 Steepest Descents Algorithm (fixed step & optimal step) 都不具備 Quadratic Convergence。(事實上最陡坡度法在搜尋解的時候會有 (歪來歪去!?) Zig-zag 的本質,這使得此法再在某些情況會收斂的異常緩慢甚至永遠不收斂...)

2. 牛頓法 (Newton-Raphson Algorithm)為Quadratic Convergence。關於牛頓法請參考:[最佳化] Generalized Newton Raphson Algorithm

3. Conjugate Direction Algorithm 為 Quadratic Convergence。有興趣的讀者請參考 Conjugate Direction Method 系列文章:[最佳化理論] Conjugate Direction Methods (0) -Basic Theory

再來要介紹的是超線性收斂(Superlinear Convergence)

===========================
Definition (Superlinear Convergence)
一個 sequence $\{ u^k\}_{k=1}^{\infty} \in \mathbb{R}^n$ 被稱作是超線性收斂 superlinear convergence 到 $u^*$ 如果下列條件成立:
給定 任意 $\theta \in (0,1)$,我們有 $\frac{||u^k - u^*||}{\theta^k} \rightarrow 0$;亦即
\[
\displaystyle \lim_{k \rightarrow \infty} \frac{||u^k - u^*||}{\theta^k} \rightarrow 0 \ \ \ \ \square
\]===========================

Comments:
1. 超線性收斂顧名思義就是其收斂速度非常的快。比線性收斂更快。我們現在用下面幾個(收斂的)例子便可以看出超線性收斂確實是快!  比如說甚至 $exp(-k)$ 函數都不是超線性收斂。
2. Conjugate Direction Algorithm 具備 Superlinear Convergence。


現在來看看幾個例子:

===========================
Example 1:
$u^k = 1/k$ 是否為超線性收斂到 $u^* =0 ?$

Sol: NO!
由定義我們可以任意選 $\theta \in (0,1)$,故如果今天我們選 $\theta =1/2$,則
\[
\displaystyle \lim_{k \rightarrow \infty} \frac{||u^k - u^*||}{\theta^k} = \displaystyle \lim_{k \rightarrow \infty} \frac{1/k}{(1/2)^k} =   \displaystyle \lim_{k \rightarrow \infty} \frac{2^k}{k} \nrightarrow 0
\]事實上上述極限不收斂 $(\rightarrow \infty)$ $\square$

===========================

Example 2
$u^k = 1/k^2$ 是否為超線性收斂到 $u^* =0 ?$

Sol: NO!
同上題,選 $\theta = 1/2$ 仍然讓此Sequence爆掉。

===========================

Example 3
$u^k = e^{-k}$ 是否為超線性收斂 到 $u^* = 0?$

Sol: No
注意到 $exp = 2.7183xxx$,故如果我們選 $\theta = 1/3$ 則
\[
\displaystyle \lim_{k \rightarrow \infty} \frac{||u^k - u^*||}{\theta^k} = \displaystyle \lim_{k \rightarrow \infty} \frac{e^{-k}}{(1/3)^k} =   \displaystyle \lim_{k \rightarrow \infty} 3^k{e^{-k}} =  \displaystyle \lim_{k \rightarrow \infty} 3^k (2.7183....)^{-k} \nrightarrow 0
\]$\square$
===========================

Example 4
$u^k = e^{-k^2}$ 是否為超線性收斂 到 $u^* = 0?$

Sol: YES
觀察
\[
\displaystyle \lim_{k \rightarrow \infty} \frac{||u^k - u^*||}{\theta^k} = \displaystyle \lim_{k \rightarrow \infty} \frac{e^{-k^2}}{\theta^k}
\]
注意到上式中的 $\frac{e^{-k^2}}{\theta^k}$ 可改寫為
\[{e^{ - {k^2}}}{\theta ^{ - k}} = {e^{ - {k^2}}}{e^{\ln {\theta ^{ - k}}}} = {e^{ - {k^2} + k\ln \frac{1}{\theta }}}
\]注意到不管 $\theta \in (0,1)$ 怎麼選,前方的 $-k^2$ 項都主導整個收斂速度,故上式收斂到 $u^* =0$,亦即 $u^k = e^{-k^2}$ 為超線性收斂 到 $u^* = 0$ $\square$

===========================

Example 5
$u^k = (1/k)^k$ 是否為超線性收斂 到 $u^* = 0?$

Sol: YES
由定義可知
\[
\mathop {\lim }\limits_{k \to \infty } \frac{{\left\| {{u^k} - {u^*}} \right\|}}{{{\theta ^k}}} = \mathop {\lim }\limits_{k \to \infty } \frac{{{{\left( {1/k} \right)}^k}}}{{{\theta ^k}}} \ \ \ \ (\star)
\]現在我們觀察
\[
\frac{{{{\left( {1/k} \right)}^k}}}{{{\theta ^k}}} = {k^{ - k}}{\theta ^{ - k}} = {\left( {k\theta } \right)^{ - k}}
\]又因為 $0 < \theta < 1$,亦即無論 $\theta$ 怎麼選,式 $(\star)$ 都必收斂
\[\mathop {\lim }\limits_{k \to \infty } {\left( {k\theta } \right)^{ - k}} \to 0
\]故 $u^k = (1/k)^k$ 為超線性收斂。$\square$


2014年1月13日 星期一

[Windows] 微軟內建的 惡意軟體移除工具

微軟在 Windows 7/8 提供了一個蠻方便的 惡意軟體移除工具(Malicious Software Removal Tool) 可以協助清理諸如一些 惡意廣告程式 等等,以下以 Windows 8.1 為例示範如何使用,首先利用搜尋功能 鍵入 mrt  如下圖


NOTE: 如果沒有此軟體的讀者,可至以下 微軟官方連結處 下載 (適用 Win XP/Vista/7/8/...)
http://www.microsoft.com/security/pc-security/malware-removal.aspx

點擊後會顯示如下圖



點選 下一步 會顯示掃描類型



在此以 快速掃描 為例,點選後會顯示



掃描完後會顯示如下畫面


2014年1月12日 星期日

[轉載] Can Control Science Bring New Insights to Stock Trading Research?

以下連結為 我的博士班指導老師 B. Ross Barmish 於 2013年 IEEE CDC 大會上的 Bode Lecture 錄影

http://www.ieeecss-oll.org/lecture/can-control-science-bring-new-insights-stock-trading-research-0

Date: 
2013
Location Information: 
2013 IEEE Conference on Decision and Control - Florence, Italy, December 2013
Author:  B. Ross Barmish
Author Bio: 
B. Ross Barmish received the Bachelor's degree in Electrical Engineering from McGill University in 1971. In 1972 and 1975 respectively, he received the M.S. and Ph.D. degrees, both in Electrical Engineering, from Cornell University. From 1975 to 1978, he served as Assistant Professor of Engineering and Applied Science at Yale University. From 1978 to 1984, he was as an Associate Professor of Electrical Engineering at the University of Rochester and in 1984, he joined the University of Wisconsin, Madison, where he is currently Professor of Electrical and Computer Engineering. From 2001 to 2003, he was with the Department of Electrical Engineering and Computer Science at Case Western Reserve University, where he served as Department Chair while holding the endowed Nord Professorship. Over the years, he has been involved in a number of IEEE Control Systems Society activities such as associate editorships, conference chairmanships, the Board of Governors and prize paper committees. He has also served as a consultant for a number of companies and is the author of the textbook New Tools for Robustness of Linear Systems, Macmillan, 1994. Professor Barmish is a Fellow of both the IEEE and IFAC for his contributions to the theory of robustness of dynamical systems. He received the Best Paper Award for Journal Publication in Automatica, covering a three-year period, on two consecutive occasions from the International Federation of Automatic Control. He has also given a number of plenary lectures at major conferences. While his earlier work concentrated on robustness of dynamical systems, his current research, the topic of this Bode lecture, concentrates on building a bridge between feedback control theory and trading in complex financial markets.

Abstract: 
My answer is "yes." In this lecture, I will make the case that there are some important open problems in finance which are ideally suited for researchers who are well versed in control theory. To this end, I will begin the presentation by quickly explaining what is meant by the notion of "technical analysis" in the stock market. Then I will address, from a control-theoretic point of view, a longstanding conundrum in finance: Why is it that so many asset managers, hedge funds and individual investors trade stock using technical analysis techniques despite the existence of a significant body of literature claiming that such methods are of questionable worth with little or no theoretical rationale? In fact, detractors describe such stock trading methods as "voodoo" and an "anathema to the academic world." To date, in the finance literature, the case for "efficacy" of such stock-trading strategies is based on statistics and empirical back-testing using historical data. With these issues providing the backdrop, my main objective in this lecture is to describe a new theoretical framework for stock trading - based on technical analysis and involving some simple ideas from robust and adaptive control. In contrast to the finance literature, where conclusions are drawn based on statistical evidence from the past, our control-theoretic point of view leads to robust certification theorems describing various aspects of performance. To illustrate how such a formal theory can be developed, I will describe results obtained to date on trend following, one of the most well-known technical analysis strategies in use. Finally, it should be noted that the main point of this talk is not to demonstrate that control-theoretic considerations lead to new "market beating" algorithms. It is to argue that strategies which have heretofore been analyzed via statistical processing of empirical data can actually be studied in a formal theoretical framework.

2014年1月4日 星期六

[隨筆] 雪 與消融

刺骨的寒風 用 冷冽 壟罩 
是這城市 冬天的 最佳寫照

我 偷偷的 吸一口氣
彷彿能 感受到 肺部的凍結

走過的路
與降下的白雪

混著 腳底踩過的碎冰

一片片雪花
綻放著獨一無二的 結晶花紋

然後漸漸 消融