Posts

Showing posts from May, 2021

Euler Angles

Before talking about the Euler angles and the rigid body motion, we first briefly review the rotations of a point in a single fixed world frame. Given a point $\mathbf{V}\equiv [x, y, z]^T$, if we rotate it along the z-axis by an angle $\theta$ to a new position $\mathbf{V'}\equiv [x', y', z']^T$, then we have the relation \begin{equation} \mathbf{V'}= R_Z(\theta)\mathbf{V}\,,\quad R_Z(\theta)\equiv\left[\begin{array}[ccc]& \cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \end{array}\right]\,.\tag{1}\end{equation} If we continue to rotate $\mathbf{V'}$ along the x-axis by another angle $\phi$, the point ends with the coordinates $\mathbf{V''}\equiv [x'', y'', z'']^T$ with relation \begin{equation} \mathbf{V''}= R_X(\phi)\mathbf{V'}\,,\quad R_X(\phi)\equiv\left[\begin{array}[ccc]& 1 & 0 & 0 \\ 0 & \cos(\phi) & -\sin(\phi) \\ 0 & \sin(\

Interview problem: Union Find

 Leetcode 684 class Solution : def findRedundantConnection ( self , edges : List [ List [ int ]]) -> List [ int ]: n = len ( edges ) parent = list ( range ( n + 1 )) rank = [ 0 ] * ( n + 1 ) def _find ( x ): if parent [ x ] == x : return x parent [ x ] = _find ( parent [ x ]) return parent [ x ] def _union ( x , y ): x = _find ( x ) y = _find ( y ) if rank [ x ] > rank [ y ]: x , y = y , x if rank [ x ] == rank [ y ]: rank [ y ] += 1 parent [ x ] = y return y for x , y in edges : if _find ( x ) == _find ( y ): return [ x , y ] _union ( x , y )

A Zee's books are fantastic

Prof.  J. Pochinski wrote in the preface of his famous string theory textbook that "one of the greatest pleasures was finding a text that made a difficult subject accessible". To me, Prof. A. Zee 's new textbook " Group Theory in a Nutshell for Physicists " is such a great text that explains a lot of concepts in group theory clearly and patiently. On one night in the last week, I opened this book for some random reading to save myself temporarily out of the recent boring daily work. It turns out I sit there for one hour and read 70 pages (page 185-255) in one go, with no awareness of the elapsed time. I took a undergraduate course of group theory before, and thus are familiar with the technical parts like $J_{\pm}, J_{z}$ or $|j, m\rangle$. But still, this is the first book I've read that explains the concepts of (irreducible) tensor representations of SO(N) and SU(N) clearly. For example, the author devoted a lot of space to convince his readers that why

Interview problem: Segment Tree

I heard the name of segment tree several times before and never had an opportunity to learn what it is. Today I finally understand the concepts of segment tree by watching these seven short youtube videos 9.1-9.7 . These lectures are highly recommended to those who are new to the topics of segment tree like me. Here is my python solution to the Leetcode 307  using the segment tree: class TreeNode : def __init__ ( self , start , end , total , left = None , right = None ): self . start = start self . end = end self . total = total self . left = left self . right = right class NumArray : def __init__ ( self , nums : List [ int ]): def _create ( start , end ): if start == end : return TreeNode ( start , end , nums [ start ]) mid = start + ( end - start ) // 2 left = _create ( start , mid ) right = _create ( mid +

Planck length as the known minimal length scale

 When I was a freshman, I was briefly taught the concepts of Planck units in the college physics course of mechanics. For example, there are three fundamental physics constants in nature: Planck constant in quantum physics $\hbar$, Newtonian constant of gravitation $G$ as well as the speed of light in vaccum $c$. Simply by the dimensional analysis , one can construct the following constants that have the dimensions of mass and length (called Planck mass and Planck length): \begin{eqnarray} m_p &=&\sqrt{\frac{\hbar c}{G}}\sim 10^{-8} kg \,,\\  l_p&=&\sqrt{\frac{\hbar G}{c^3}}\sim 10^{-35}m\,. \end{eqnarray} Besides its small value of $10^{-35}m$ , why the Planck length is said to be the known minimal length scale? I recently found a simple argument from Prof. Hong Liu's lecture notes on AdS/CFT that one can never measure an object's position precisely within the error smaller than the Planck length. Given an object with mass $m$, there are two associated len