發表文章

目前顯示的是 9月, 2026的文章

以內積證明柯西—施瓦茲不等式 | 應用範例

  Proof of the Cauchy–Schwarz Inequality Using Inner Product 柯西—施瓦茲不等式如下所示: 若 $a_1$,$a_2$,$...$,$a_n$,以及 $b_1$,$b_2$,$...$,$b_n$ 均為實數,則 $(a_1b_1+...+a_nb_n)^2\le (a_1^2+...+a_n^2)(b_1^2+...+b_n^2)$ 證明: 令 $\mathbf A$ 與 $\mathbf B$ 為 $n$ 維空間的兩個向量, $$\mathbf A=(a_1,...,a_n)\;\;\;\;\;\;且\;\;\;\;\;\;\mathbf B=(b_1,...,b_n)$$ 已知 $$\mathbf A \cdot \mathbf B=\Vert \mathbf A \Vert \Vert\mathbf B\Vert\cos \theta$$ 其中的 $0\le\theta \le \pi$,是 $\mathbf A$ 與 $\mathbf B$ 之間的夾角。 則 $$\cos \theta =\frac{\mathbf A \cdot \mathbf B}{\Vert\mathbf A\Vert\Vert\mathbf B||}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;$$ $$=\frac{a_1b_1+...+a_nb_n}{(a_1^2+...+a_n^2)^{1/2}(b_1^2+...+b_n^2)^{1/2}}$$ 又已知 $$\vert \cos \theta \; \vert \le 1$$ 所以 $$\frac{\vert a_1b_1+...+a_nb_n\vert}{(a_1^2+...+a_n^2)^{1/2}(b_1^2+...+b_n^2)^{1/2}}\le 1$$ 即 $$\vert a_1b_1+...+a_nb_n\vert \le (a_1^2+...+a_n^2)^{1/2}(b_1^2+...+b_n^2)^{1/2}$$ 不等式兩邊平方可得 $$(a_1b_1+...+a_nb_n)^2 \le (a_1^2+.....

如何以 NAND 閘或 NOR 閘實作 XOR 閘

圖片
How to Implement An XOR Gate Using Only NAND Or NOR Gates 如圖一所示的互斥或閘 (XOR Gate) ,是可以只由反及閘 (NAND Gate) 或反或閘 (NOR Gate) 這兩種萬用閘 (Universal Gate) 分別來實作。下面我們將分別說明其原理:   圖一  互斥或閘 ( XOR gate) 以反及閘實作互斥或閘  ( Implementing An XOR Gate Using NAND Gates ) 利用布林代數的 補數 (Complement) 公設 : $X\overline X=0$ 、 單位元素與零元素的存在公設 : $X+0=X$ 、 分配律 (Distributivity) 公設 : $X\cdot (Y+Z)=(X\cdot Y)+(X\cdot Z)$ 、 第摩根定理 (DeMorgan's Law): $\overline {X\cdot Y}=\overline X+\overline Y$ 以及 自補定理 (Involution Theorem): $\overline {\overline X}=X$ ,則 $Y$ 的布林代數式可改寫成: $$Y=A \oplus B\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;$$ $$=A\overline B+\overline {A} B\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;$$ $$\;\;=A\overline B+A\overline A+\overline A B+B\overline B$$ $$\;\;=A (\overline A+\overline B)+B (\overline A+\overline B)$$ $$=A\;\overline {AB}+B\;\overline {AB}\;\;\;\;\;\;\;\;\;\;$$ $$=\overline {\overline { A\;\overline {AB}+B\;\overline {AB}}}\;\;\;\;\;\;\;\;\;\;$$ $$=\overline {\overline {A\overline {...

三角函數的導數

Derivatives of Trigonometric Functions   三角函數在數學、物理學以及工程學上均佔有極重要的角色。本文在此主要說明三角函數導數 (Derivative) 的推導以及其對應的積分公式。首先,$\sin x$ 與 $\cos x$ 導數的推導,我們將利用尤拉公式 (Euler's Formula) 來完成。其餘的三角函數的導數,則會應用微分法則與三角函數等式來得到。 $\frac{d}{dx}\;\sin x=\cos x$ 對應的積分 $\int \cos x\;dx=\sin x+C$ 若 $u$ 為一可微的 $x$ 函數,則 $\frac{d}{dx} \sin u=\cos u \frac{du}{dx}$ 推導: 由尤拉公式 $$e^{ix}=\cos x+i\sin x\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\forall\;x\in R$$ 可知 $$\sin x=\mathcal {Im}\left \{e^{ix}\right \}$$ 其中的 $\mathcal {Im}\{Z\}$ 表示複數 $Z$ 虛部 (Imaginary Part) 的意思。因此, $$\frac{d}{dx}\;\sin x=\frac{d}{dx}\;\mathcal {Im}\left \{e^{ix}\right \}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;$$ $$\;=\mathcal {Im}\left \{\frac{d}{dx}\;e^{ix}\right \}$$ $$=\mathcal {Im}\left \{ie^{ix}\right \}\;\;\;\;\;\;$$ $$\;\;\;\;\;\;\;\;\;\;\;\;\;=\mathcal {Im}\{i(\cos x+i\;\sin x)\}$$ $$\;\;\;\;\;\;\;\;\;\;\;\;=\mathcal {Im}\{-\sin x+i\;\cos x \}$$ $$=\cos x\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;$$ 其對應的積分為 $$\int \cos x\;dx=\sin x+C$$ 此外,如果 $u$ 為一可微的 $x$ 函數 ( 即 $u=f...

正弦電動勢 RLC 串聯電路的電流分析 | 線性二階微分方程應用

圖片
  Current Analysis of A Series RLC Circuit Driven by A Sinusoidal Voltage Input 如圖一所示,為一正弦電動勢的 RLC 串聯電路。 圖一    正弦電動勢 RLC 串聯電路 假設迴路的電流為 $i$,則電阻 $R$ 的電壓降為 $Ri$,電感 $L$ 的電壓降為 $L\frac{di}{dt}$,電容 $C$ 的電壓降為 $\frac{1}{C}\int i\;dt$。根據 $KVL$,可知 $$Ri+L\frac{di}{dt}+\frac{1}{C}\int i\;dt=E\;\sin \omega t$$ 上式等號兩邊對 $t$ 微分,可得 $$R\frac{di}{dt}+L\frac{d^2i}{dt^2}+\frac{i}{C}=E\omega\cos \omega t$$ 整理得 $$\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\frac{d^2i}{dt^2}+\frac{R}{L}\frac{di}{dt}+\frac{i}{LC}=\frac {E}{L}\omega \cos \omega t\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(1)$$ 為一 線性二階非齊次微分方程 (Second-order Linear Non-homogeneous Differential Equation)。其通解 (General Solution) 的形式為 $i_h+i_P$,其中的 $i_h$ 為 齊次解 (Homogeneous Solution),而 $i_p$ 則是 特殊解 (Particular Solution)。 求齊次解 $i_h$ 要找出式子 (1) 的齊次解,即是找出下面式子的的通解。 $$\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\frac{d^2i}{dt^2}+\frac{R}{L}\frac{di}{dt}+\frac{i}{LC}=0\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(2)$$ 而 (2) 的 特徵方程式  (Characteristic Equati...