ipython で matplotlib を使うとき inline 表示にしない

%matplotlib auto

カテゴリー: matplotlib, python | コメントする

三角関数に関する公式

(1)   \begin{align*}    \sin{(x+y)} &= \sin{x}\cos{y} + \cos{x}\sin{y})\\                &= \cos{y} (\sin{x} +\tan{y}\cos{x}) \end{align*}

(2)   \begin{align*}    \frac{1-\cos x}{\sin x} = \tan(x/2) \end{align*}

(3)   \begin{align*}    \frac{\sin x}{1+\cos x} = \tan(x/2) \end{align*}

(4)   \begin{align*}   \cos x + \cos(x+\delta) &= (1+\cos\delta)\cos{x} - \sin{\delta}\sin{x}\\                &= \sqrt{2(1+\cos{\delta})}\cos(x + \delta/2) \\                &= 2\cos(\delta/2)\cos(x +\delta/2)  \ \text{for}\ \delta>0 \end{align*}

because

(5)   \begin{align*} a\cos{x}+b\sin{x}=R\cos(x-\alpha) \ \text{with}\ R=\sqrt{a^{2}+b^{2}},\ \tan \alpha=b/a  \end{align*}

たとえば,

(6)   \begin{align*}   \frac{1}{2}\left[\cos x + \cos(x+\delta)\right]        &= \cos(\delta/2)\cos(x + \delta/2) \end{align*}

カテゴリー: 未分類 | コメントする

行列(配列) array に対する操作

numpy 行列(配列)  array に対する操作

 

*行列の左右のみを反転させる.

numpy.fliplr(a)

http://docs.scipy.org/doc/numpy/reference/generated/numpy.fliplr.html

*転置行列

a.T

 

*行列形式のデータの表示

matplotlib.pyplot.imshow(a, interpolation=’nearest’)

 

 

imshow_array

カテゴリー: python | コメントする

TTree 内の各エントリに対する操作

pyROOT では TTree  tree の各エントリー event のある変数 x1 , x2 を得るとき,これでできる

 

参考:

https://root.cern.ch/phpBB3/viewtopic.php?t=10962

カテゴリー: pyROOT, python | コメントする

pyROOT でヒストグラムの情報を得る操作

既に存在する 1 次元ヒストグラム (h1) のビンの数,ビンの最小値,ビンの最大値を得には次のようにする.
(pyRoot ではなく C のときは,メソッドを呼び出す記号は “.” ではなく “->”)

 

第 i 番目のビンの下端,中心値,上端を得る

 

2 次元ヒストグラム (h2) の場合, Y 軸のビンの数や,最小のビンのを知るには,

 

Fill された値がどのビン番号 (index) に属するかを調べるには,FindBin() を使う.

ヒストグラムの最大値/最小値をもつビンの index を返すには,

 

 

カテゴリー: pyROOT | コメントする