Mar 17, 2014

3/2-17感冒紀錄

剛開始左邊喉嚨癢。

第一二天後左邊喉嚨很痛很腫,吞口水會痛,晚上睡不好,但是沒咳。第三天連摸脖子都有點痛的感覺。

第三天去看醫生吃藥後,喉嚨腫痛症狀是好很多,但開始咳嗽,咳到睡不著,而且晚上忽冷忽熱滿身大汗可以發生十次,要起床十次換衣服。

連續五六天吃藥,但是都是同樣症狀,晚上都是咳嗽幾乎沒甚麼睡,早上都稍微有點燒得感覺,但是量體溫又在36度左右,沒有真正燒。第六天後開始流膿黃鼻水,咳嗽也沒有好,痰非常的黃。另外身體非常虛弱,全身肌肉痠痛,有時連走動都沒甚麼力氣的感覺。另外都是早上症狀會比較輕微,甚至有時候完全不會咳,幾乎像好了一樣,因此有一天因為這假象以為自己好了還跑去踢足球。但是到了晚上五六點症狀就會開始加劇,主要是咳嗽,晚上睡覺更嚴重。這幾天頭殼都好像有點燒壞的感覺,很難做事情思考事情。
(第二次用藥: Clarithromycin250 , Meptin25, Voren25, Medcon-A, Strocain, Tetosiv sustained)
(第三次用藥: Cravit500MG, Allegra, Panamax, Mucosolven, Gaster20MG, Anticough Capsules)

第八天停止吃藥,因為發現沒有比較好,而且吃藥反而讓身體感受不到身體的狀況。另外發現好像躺在舊床上就開始咳,懷疑是因為汗水浸濕那個四十年的老舊床鋪而有發霉的現象,因為屢試不爽,為此馬上換了一張床墊。當晚咳嗽就好很多。但還是冒汗兩三次。頭還是有點不舒服。

第九天,咳嗽開始好一點,但鼻水還是狂流,痰還是很多。

第十天,晚上冒汗狀況慢慢改善,但改善的非常慢。喉嚨腫痛有一天開始移向右邊。不過還好右邊喉嚨後來沒咳破。

第十一天,都好很多,但還是咳,鼻水還是超級多且濃黃。身體肌肉整個萎縮。

第十五天,慢慢休養五天,終於症狀都好多,有點力氣。還是小咳。

第十七天,可以上圖書館,跑步,小小咳。

Mar 15, 2014

剛體轉動的數值模擬

這邊介紹一個簡單的剛體轉動的數值模擬方法,這如果當教科書例題的話好像還不錯。我們以陀螺為例子,對陀螺的尤拉方程(Euler equation)的貼體角速度(body angular velocity)直接進行方向餘弦遞推數值積分。只要給定初始條件,即可追蹤模擬陀螺的完整運動。以此方法寫出的程式非常簡單,這邊以Python程式編寫。最後模擬了陀螺的四種經典運動:尖點,有環,無環,等周速運動。完整的物理理論證明也在我另一篇提供,因此這邊只寫下方法。

剛體轉動(Rigid body rotation)的尤拉方程如下,
重新整理成以下形式就可用簡單的四階Runge Kutta數值方法解出ωb(t),

一般認為解出貼體角速度ωb(t)並無太大用處,因此一般書上在這裡會轉而求諸尤拉角(euler angle)並且用Lagrangian mechanics求出完整的解析解,不過完整的陀螺解析解包含橢圓積分(elliptic intergral)因此數值計算上相對我們這邊介紹得更為複雜。事實上若給定貼體角速度在空間座標上的初始值,我們可以以數值積分方法的初始值問題一步步求出剛體的貼體座標在空間座標中的運動,雖然我們沒有得到完整的解析解,我們還是可以完整模擬陀螺的三維運動。(此方法屬於方向餘弦矩陣遞推法,其物理證明在另一篇完整的證明中提供。)

我們考慮陀螺的body對稱單位軸z軸,假設z軸在空間中的初始位置為z(t0),我們以此為出發點,計算z(t0)沿著ωb(t1)向量旋轉|ωb(t1)|*dt角度後,轉動後新的z軸為z(t1),接著再沿著ωb(t2)向量旋轉|ωb(t2)|*dt角度後轉到z(t2),以此可以算出z(t1~N)。(這邊當然需要考慮微小轉動向量的特性infinitesimal rotation)

以下是python模擬出的四種經典運動的locus圖(body z軸跟單位圓的交叉點的軌跡圖),參數也有寫在圖中。
尖點運動
有環運動
無環運動
等周速運動
以及有環運動的3D動畫(也是python寫的)




the python code

此篇文章有新版,請見whymranderson.blogspot.tw/2014/03/4th-runge-kutta.html

Mar 12, 2014

some great matches in CSGO, cool CSGO avitar names, and try to come up with some of my own, casters i like

Converted document
Some of the greatest matches in professional CSGO (chronologically, in reverse)
Some of the avatar names and casters I like:
Existing_names pusha, olofmeister, byali, apex, faflaren, karrigan, jkaem, hani, simple, cyjanb, nothing , shox, kioshima,
Cranking_my_head mehidae (somehow rhythm with meditate) toothless (from the movie "how to train your dragon") silen (silence) andoni (antoine) pfeifer (vacuum pump company - pfeiffer) timee continuing...
Casters ddk black ddk henryG warowl a few that I still need to find their names......

Mar 9, 2014

Typeset mix Chinese and English TeX documents with Scientific Workplace 5.0 and TEX live 2013

  You can typeset Chinese documents with Scientific Workplace (5.0) if you have just a few Chinese paragraphs. But if you have a long Chinese document or a document with mix Chinese and English characters, the software will suffer. The SWP's compiler for international characters, Omega, is just not good enough for this purpose. You will run into a lot of overfull hbox problems during typesetting. We will need another latex compiler for long documents of mix Chinese and English. But we will want to use the convenient editing features of Scientific Workplace, what should we do?

Here is something you can try. Still prepare your international document with SWP. But typeset it with another latex compiler. Here I use a popular one, XeLATEX in TEX live 2013. But there are a few problems. First, the file prepared by SWP has a character encoding that is not recognized by other latex compiler. So I wrote a small Python program to convert the encoding. Second, the figure insertion syntax generated by SWP is not recognized  by XeLatex. But this can be done by inserting TEX fields containing the correct Xelatex figure insertion commands into the SWP file by using SWP's TEX OBJECTS buttons. You won't be able to preview the figures SWP window but that doesn't really hurt. Here are step-by-step details:

  • How to convert SWP 5.0 special unicode format file to unicode correct characters:
SWP version 5.0 produced Chinese character in its special unicode codepoint format (if you open the tex file with any text editor, you will see every Chinese character has a form like \U{6211} instead of displaying 我 in the tex file.) This is due to the extra parenthesis {} after \U. So I wrote a small python program to automatically remove all {} in the tex file. So that the file can then be prepared by other tex programs (Tex Life 2013 in my case).

The program is very simple:
import re
import codecs
def dashrepl(matchobj):
    return chr(int(matchobj.group(1),16))
f1 = open('rotationV4pngtest.tex', 'r')   # name of your origianl file
f2 = codecs.open('rotationV4pngtest.tex.temp', "w", "utf-8")   #  name of the new file
p= re.compile(r"\\U{([\w]{,4})}")
for line in f1:
    m = re.sub(p,dashrepl,line)
##    print(m)
    f2.write(m)
f1.close()
f2.close()


  • For the SWP tex file to be readable by other compiler, you will also need to change the preamble (the packages and stuff)  in the beginning of the tex document so that other tex program can use it. Here is my case:
Original preamble generated by SWP:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{sw2unicode}
\usepackage[UT1]{fontenc}
\usepackage{pmingliu}
\usepackage[left=0.95in,right=0.95in,top=2cm,bottom=2.54cm]{geometry}
Change the above to the following so that Xelatex can complie:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{xeCJK}
\setmainfont[Mapping=tex-text]{Times New Roman} % rm
\setsansfont[Mapping=tex-text]{Arial}           % sf
\setmonofont{Courier New}                       % tt
\setCJKmainfont{微軟正黑體}
\usepackage[left=0.95in,right=0.95in,top=2cm,bottom=2.54cm]{geometry}
\usepackage{unicode-math}
\usepackage{graphicx}
\usepackage[hidelinks]{hyperref}


  • The file generated by SWP has symbols that use SWP's "tcilatex" macro, so you need to copy tcilatex.tex file into the same directory as your tex file. The location of tcilatex.tex in SWP's path has the following structure "D:\swp50\TCITeX\TeX\LaTeX\SWmacros\". Locate this file and copy it into your working directory. Then make sure your tex file has the \input{tcilatex.tex} line. You should have this line because you prepared your file with SWP.

  • Change the TEX figure insertion command:

The figure insertion command for Xelatex should look like this:
\begin{figure}[th]
\caption{{}}
\label{firstfig}
\begin{center}
\fbox{\includegraphics[scale=0.7]{cordtrans.JPG}}
\end{center}
\end{figure}

So open the SWP tex file with Notepad and replace all things look like the following with the above

\FRAME{fhF}{5.5097in}{3.7135in}{0pt}{}{}{cordtrans.JPG}{\special{language
"Scientific Word";type "GRAPHIC";maintain-aspect-ratio TRUE;display
"USEDEF";valid_file "F";width 5.5097in;height 3.7135in;depth
0pt;original-width 9.135in;original-height 6.1436in;cropleft "0";croptop
"1";cropright "1";cropbottom "0";filename
'
cordtrans.JPG';file-properties "XNPEU";}}

There could be other commands you need to change before you can run your tex document with TEX life Xelatex. Here I only show three points, which is enough for me to typeset this document. Good luck!

鋼琴伴奏譜+彈唱 [轉錄 from 鸠玖的音乐世界 土豆網]

一個值得推薦的心血結晶 編曲最接近原版的鋼琴伴奏譜+他自己的超棒的彈唱
真是我的偶像阿~~
http://www.tudou.com/plcover/-ysO_c-u4NY/

Mar 1, 2014

使用Scientific Workplace 5.0 + XeLatex軟體做中英文混雜並夾帶數學公式的長篇圖文文章電腦排版

  這邊介紹如何利用Scientific Workplace 5.0的編輯方便性,加上XeLatex (TeX life 2013)對中英文混雜的完美支援,來對中英文混雜並夾帶數學公式的長篇圖文文章做自動排版。