Skip to content

Latest commit

 

History

History
executable file
·
196 lines (156 loc) · 5.36 KB

EXAMPLES.md

File metadata and controls

executable file
·
196 lines (156 loc) · 5.36 KB

SwiftMath Examples

Square of sums

(a_1 + a_2)^2 = a_1^2 + 2a_1a_2 + a_2^2

Square Formula Square Formula

Quadratic Formula

x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}

Quadratic Formula Quadratic Formula

Standard Deviation

\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^N (x_i - \mu)^2}

Standard Deviation Standard Deviation

De Morgan's laws

\neg(P\land Q) \iff (\neg P)\lor(\neg Q)

De Morgan De Morgan

Log Change of Base

\log_b(x) = \frac{\log_a(x)}{\log_a(b)}

Log Base Change Log Base Change

Cosine addition

\cos(\theta + \varphi) = \cos(\theta)\cos(\varphi) - \sin(\theta)\sin(\varphi)

Cos Sum Cos Sum

Limit e^k

\lim_{x\to\infty}\left(1 + \frac{k}{x}\right)^x = e^k

Limit Limit

Calculus

f(x) = \int\limits_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,\mathrm{d}\xi

Calculus Calculus

Stirling Numbers of the Second Kind

{n \brace k} = \frac{1}{k!}\sum_{j=0}^k (-1)^{k-j}\binom{k}{j}(k-j)^n

Stirling Numbers Stirling Numbers

Gaussian Integral

\int_{-\infty}^{\infty} \! e^{-x^2} dx = \sqrt{\pi}

Gauss Integral Gauss Integral

Arithmetic mean, geometric mean inequality

\frac{1}{n}\sum_{i=1}^{n}x_i \geq \sqrt[n]{\prod_{i=1}^{n}x_i}

AM-GM AM-GM

Cauchy-Schwarz inequality

\left(\sum_{k=1}^n a_k b_k \right)^2 \le \left(\sum_{k=1}^n a_k^2\right)\left(\sum_{k=1}^n b_k^2\right)

Cauchy Schwarz Cauchy Schwarz

Cauchy integral formula

f^{(n)}(z_0) = \frac{n!}{2\pi i}\oint_\gamma\frac{f(z)}{(z-z_0)^{n+1}}dz

Cauchy Integral Cauchy Integral

Schroedinger's Equation

i\hbar\frac{\partial}{\partial t}\mathbf\Psi(\mathbf{x},t) = -\frac{\hbar}{2m}\nabla^2\mathbf\Psi(\mathbf{x},t)
+ V(\mathbf{x})\mathbf\Psi(\mathbf{x},t)

Schroedinger Schroedinger

Lorentz Equations

Use the gather or displaylines environments to center multiple equations.

\begin{gather}
\dot{x} = \sigma(y-x) \\
\dot{y} = \rho x - y - xz \\
\dot{z} = -\beta z + xy"
\end{gather}

Lorentz Lorentz

Cross product

\vec \bf V_1 \times \vec \bf V_2 =  \begin{vmatrix}
\hat \imath &\hat \jmath &\hat k \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0
\end{vmatrix}

Cross Product Cross Product

Maxwell's Equations

Use the aligned, eqalign or split environments to align multiple equations.

\begin{eqalign}
\nabla \cdot \vec{\bf E} & = \frac {\rho} {\varepsilon_0} \\
\nabla \cdot \vec{\bf B} & = 0 \\
\nabla \times \vec{\bf E} &= - \frac{\partial\vec{\bf B}}{\partial t} \\
\nabla \times \vec{\bf B} & = \mu_0\vec{\bf J} + \mu_0\varepsilon_0 \frac{\partial\vec{\bf E}}{\partial t}
\end{eqalign}

Maxwell's Equations Maxwell's Equations

Matrix multiplication

Supported matrix environments: matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix.

\begin{pmatrix}
a & b\\ c & d
\end{pmatrix}
\begin{pmatrix}
\alpha & \beta \\ \gamma & \delta
\end{pmatrix} = 
\begin{pmatrix}
a\alpha + b\gamma & a\beta + b \delta \\
c\alpha + d\gamma & c\beta + d \delta 
\end{pmatrix}

Matrix Multiplication Matrix Multiplication

Cases

f(x) = \begin{cases}
\frac{e^x}{2} & x \geq 0 \\
1 & x < 0
\end{cases}

Cases Cases

Splitting long equations

\frak Q(\lambda,\hat{\lambda}) =
-\frac{1}{2} \mathbb P(O \mid \lambda ) \sum_s \sum_m \sum_t \gamma_m^{(s)} (t) +\\
\quad \left( \log(2 \pi ) + \log \left| \cal C_m^{(s)} \right| +
\left( o_t - \hat{\mu}_m^{(s)} \right) ^T \cal C_m^{(s)-1} \right) 

Long equation Long equation