Simple MathJax in WordPress

References

At first, we sample f(x) in the N (N is odd) equidistant points around x:
fk=f(xk),xk=x+kh,k=N12,,N12
where h is some step.
Then we interpolate points {(xk,fk)} by polynomial
PN1(x)=j=0N1ajxj

Its coefficients {aj} are found as a solution of system of linear equations:
{PN1(xk)=fk},k=N12,,N12

Escape the Dollar Sign in Money
Differentiate the dollar sign in money from the LaTeX delimiter by escaping the monetary dollar sign with a backslash.  For example, “the book costs $ 1.00; the area is x2y2 feet”.

1
the book costs \$ 1.00; the area is $x^2y^2$ feet

In-line mode: i=0ni2=(n2+n)(2n+1)6

1
$\sum_{i=0}^n i^2 = \dfrac{(n^2+n)(2n+1)}{6}$

Display mode:
i=0ni2=(n2+n)(2n+1)6

1
$$\sum_{i=0}^n i^2 = \dfrac{(n^2+n)(2n+1)}{6}$$

Begin Align Equations
37=7321122=7321227321732=7321227321732=7312117327312(112732)

1
2
3
4
5
6
7
\begin{align}
\sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\
 & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\
 & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\
 & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\
 & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right)
\end{align}
1
2
3
4
5
6
7
8
9
$$\small
\begin{align}
\sqrt{37} &= \sqrt{\frac{73^2-1}{12^2}} \\
&= \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\
&= \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\
&= \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\
&\approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \\
\end{align}
$$
$$\small
\begin{align}
\sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\
& = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\
& = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\
& = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\
& \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \\
\end{align}
$$

Resize Integral Sign from default to Huge
T=titf1+(dxy)2c(x,y)dxT=titf1+(dxy)2c(x,y)dx

1
2
3
4
5
\begin{align}
T &= {\int_{t_i}^{t_f}} \dfrac{\sqrt {1 + \bigg( \dfrac{dx}{y} \bigg)^2 } }{c(x,y)} dx \\
\\
T &= {\Huge \int_{t_i}^{t_f}} \dfrac{\sqrt {1 + \bigg( \dfrac{dx}{y} \bigg)^2 } }{c(x,y)} dx \\
\end{align}

Example of using a newcommand to define the absolute square of a number

|a1|2+|a2|2+|a3|2=1|a1|2×|a2|2log(|a1|2|a2|2)

1
2
3
4
5
6
$\newcommand{\abssq}[1]{{\lvert \, {#1} \, \rvert}^{\,2}}$
\begin{align}
\abssq{a_1} + \abssq{a_2} + \abssq{a_3} \dots = 1 \\
\abssq{a_1} \times \abssq{a_2} \\
log ( \abssq{a_1} \, \abssq{a_2} ) \\
\end{align}

newcommand for Dirac Notation Symbols

|aketb|braΨ|Ψbraket|ψ|absolute value|ψ|2absolute value squaredΨ2|Ψbraketψ|A|ψexpected value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
\[
\newcommand{\abs}[1]{\lvert \, {#1} \, \rvert}
\newcommand{\uvec}[1]{\boldsymbol{\hat{#1}}}
\newcommand{\braket}[2]{\left\langle{#1} \, \middle|\, {#2}\right\rangle}
\newcommand{\expval}[3]{\left \langle{#1} \, \middle |\, {#2}\, \middle |\, {#3} \right\rangle}
\]
\begin{align}
\ket{a} && \text{ket} \\
\bra{b} && \text{bra} \\
\braket{\Psi^*}{\Psi} && \text{braket} \\
\abs{\psi} && \text{absolute value} \\
\abssq{\psi} && \text{absolute value squared} \\
\braket{\frac{\Psi^*}{2}} {\Psi} && \text{braket} \\
\expval{\psi}{A}{\psi} && \text{expected value} \\
\end{align}

Add two kets
|d=|b+|c=[b1b2bN]+[c1c2cN] 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$$\ket{d} = \ket{b} + \ket{c} =
\begin{bmatrix}
b_1 \\
b_2 \\
\vdots \\
b_N
\end{bmatrix}  +
\begin{bmatrix}
c_1 \\
c_2 \\
\vdots \\
c_N
\end{bmatrix} \
$$

equation vs equation*
The non-starred version provides a numbered equation, which you can easily refer to with \label and \ref. The starred version does not provide the equation number, while keeping the same format.  But the default configuration in Simple MathJax does not seem to number the equations.

e=mc2

F=ma

1
2
3
4
5
6
7
\begin{equation}
e=mc^2
\end{equation}
 
\begin{equation*}
F = ma
\end{equation*}

Example: equation* in LaTeX
(k=1nakbk)2(k=1nak2)(k=1nbk2)

1
2
3
\begin{equation*}
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
\end{equation*}

Summation limits above and below the summation sign
=SN=R+S1(nk)k=RN=R+S1(nk)

1
2
3
\begin{align}
&= \dfrac{\sum\limits_{S}^{N=R+S-1} \binom{n}k } {\sum\limits_{k=R}^{N=R+S-1} \binom {n}k
\end{align}

\color{ } tag
This is example of colored LaTeX E=mc2some sample textrevert to regular color 

1
This is example of colored LaTeX ${\color{red} E = mc^2 \quad \text{some sample text}} \quad \text{revert to regular color}$ 

Split parentheses across two lines
a=(1+2+3++2+1+)

1
2
3
4
\begin{aligned}
a=&\left(1+2+3+  \cdots \right. \\
& \cdots+ \left. \infty-2+\infty-1+\infty\right)
\end{aligned}

Combinatorics: choose k objects from a set of n objects
P(k)=(nk)pk(1p)nk

1
2
3
\begin{equation}
P(k) = {n \choose k} p^k (1-p)^{ n-k}
\end{equation}

Symbols for Set Theory
In the examples C = {1,2,3,4} and D = {3,4,5}
C D = {1,2,3,4} {3,4,5} = {1,2,3,4,5}
C D = {1,2,3,4} {3,4,5} = {3,4}
{3,4,5} D
{3,5} D
{1} C
{1,6} C
{1,2,3} {1,2,3}
{1,2,3,4} {1,2,3}
{1,2,6} {1,9}
Dc = {1,2,6,7}
x x = {1,2,3}
i=1,2,,n
AB
0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
In the examples C = {1,2,3,4} and D = {3,4,5}
C $\cup$ D = {1,2,3,4} $\cup$ {3,4,5} = {1,2,3,4,5}
C $\cap$ D = {1,2,3,4} $\cap$ {3,4,5} = {3,4}
{3,4,5} $\subseteq$ D
{3,5} $\subset$ D
{1} $ \in C$
{1,6} $\notin$ C
{1,2,3} $\supseteq$ {1,2,3}
{1,2,3,4} $\supset$ {1,2,3}
{1,2,6} $\not\supset$ {1,9}
$D^c$ = {1,2,6,7}
x $\ni$ x = {1,2,3}
$\forall \, i = 1, 2, \dots, n$
$A \setminus B$
$\aleph_0$

Continued Fractions

21+21+21+21

1
$$\cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1}}}}$$

An Identity from Ramanujan (using continued fractions)
1(ϕ5ϕ)e25π=1+e2π1+e4π1+e6π1+e8π1+

1
2
3
\begin{equation}
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\cfrac{e^{-2\pi}} {1+\cfrac{e^{-4\pi}} {1+\cfrac{e^{-6\pi}} {1+\cfrac{e^{-8\pi}} {1+\ldots} } } }
\end{equation}

A Rogers-Ramanujan Identity
1+q2(1q)+q6(1q)(1q2)+=j=01(1q5j+2)(1q5j+3),for |q|<1.

1
2
3
\begin{equation}
 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for $|q|&lt;1$}.
\end{equation}

Cross Product
V1×V2=|ijkXuYu0XvYv0|

1
2
3
4
5
6
7
8
\begin{equation*}
\mathbf{V}_1 \times \mathbf{V}_2 =
\begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\dfrac{\partial X}{\partial u} & \dfrac{\partial Y}{\partial u} & 0 \\
\dfrac{\partial X}{\partial v} & \dfrac{\partial Y}{\partial v} & 0 
\end{vmatrix}
\end{equation*}

Set Fontsize 
https://www.overleaf.com/learn/latex/Font_sizes%2C_families%2C_and_styles#Reference_guide
tiny.
scriptsize
\footnotesizefootnotesize
small
normalsize.
large.
Large
LARGE.
huge.
Huge.
\normalsize \text{ normalsize in typewriter font.}
Example  Example \textbfExample

1
2
3
4
5
6
7
8
9
10
11
12
${\tiny tiny.}$
$\scriptsize \text{scriptsize}$
$\footnotesize \text{footnotesize}$
$\small \text{small}$
$\normalsize \text{normalsize.}$
$\large \text{large.}$
$\Large \text{Large}$
$\LARGE \text{LARGE.}$
${\huge huge.}$
${\Huge Huge.}$
${\texttt {\normalsize \text{ normalsize in typewriter font.}}}$
$\textbf{Example } \texttt{ Example } \texttt \textbf{Example}$

Numbering and Referencing Equations – Part 1
(1)e=mc2(2a)(22me2+V(r))Ψ=EΨ(2b)H^Ψ=EΨ
Equation (1) is one of the greatest equations in mankind’s history.
Equation (2a) and (2b) are time-independent Schrödinger Equation.

1
2
3
4
5
6
7
\begin{align}
e&=mc^2 \tag{1}\label{eq1} \\
\Big(\, -\, \dfrac{\hbar^2}{2m_e} {\nabla}^2 + V(\textbf{r}) \, \Big)\, \Psi &= E \, \Psi  \tag{2a} \label{eq2a}\\
\widehat{\cal{H}} \, \Psi &= E \, \Psi \tag{2b} \label{eq2a}\\
\end{align}
Equation $\eqref{eq1}$ is one of the greatest equations in mankind's history.
Equation $\eqref{eq2a} \text{ and } \eqref{eq2b}$ are time-independent Schrödinger Equation.

Numbering and Referencing Equations – Part 2
Set fontsize and color for all equations

(3)a=b+c(4)x=yz(5)l=mn

1
2
3
4
5
6
7
$\Huge \color{red}
\begin{align}
a &= b + c \tag{3}\label{eq3} \\
x &= yz \tag{4}\label{eq4}\\
l &= m - n \tag{5}\label{eq5}\\
\end{align}
$

Numbering and Referencing Equations – Part 3
Set fontsize and color for individual equations and variables

(6)a=b+c(7)x=yz(8)l=mn

1
2
3
4
5
\begin{align}
\large \color{red} a &= \large \color{red} b + c \tag{6} \label{eq6} \\
\color{blue} x &= \color{purple} yz  \tag{7} \label{eq7} \\
\color{green} l &= \color{cyan} m - n \tag{8} \label{eq8} \\
\end{align}

Elementary row operations (Gauss-Jordan elimination)

[11111012350202201231]R1R2R3R2R4R2[101240123500441200404]14R414R3[10124012350011300101]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$
\left[\begin{array}{rrrr|r}
1 & 1 & 1 & 1 &1 \\
0 & 1 & 2 & 3 & 5 \\
0 & -2 & 0 & -2 & 2 \\
0 & 1 & -2 & 3 & 1 \\
\end{array} \right]
\xrightarrow{\substack{ {R_1-R_2} \\ {R_3-R_2} \\ {R_4-R_2} }}
\left[\begin{array}{rrrr|r}
1 & 0& -1 & -2 &-4 \\
0 & 1 & 2 & 3 & 5 \\
0 & 0 & 4 & 4 & 12 \\
0 & 0 & -4 & 0 & -4 \\
\end{array}\right]
\xrightarrow[\frac{-1}{4}R_4]{\frac{1}{4}R_3}
\left[\begin{array}{rrrr|r}
1 & 0& -1 & -2 &-4 \\
0 & 1 & 2 & 3 & 5 \\
0 & 0 & 1 & 1 & 3 \\
0 & 0 & 1 & 0& 1 \\
\end{array}\right]
$

Use array for tabular
aa2(mod5)2a2(mod5)000112243343412

1
2
3
4
5
6
7
8
9
10
11
12
13
$$
\begin{array}{ |c|c|c| }
\hline
a & a^2 \pmod{5} & 2a^2 \pmod{5} \\
\hline
0 & 0 & 0 \\
1 & 1 & 2 \\
2 & 4 & 3 \\
3 & 4 & 3 \\
4 & 1 & 2 \\
\hline
\end{array}
$$

Giving reasons for each line in align

f(ab)=(ab)2(by definition of f)=(ab)(ab)=a2b2(since G is abelian)=f(a)f(b)(by definition of f).

1
2
3
4
5
6
7
$\normalsize$
\begin{align*}
f(ab)&=(ab)^2 && (\text{by definition of $f$})\\
&=(ab)(ab)\\
&=a^2 b^2 && (\text{since $G$ is abelian})\\
&=f(a)f(b) && (\text{by definition of $f$}).
\end{align*}

Explanations Above (overbrace) and below (underbrace) Equations
a0+a1+a2++anxn=1+1++1n times.

1
2
3
4
5
\begin{align}
\overbrace{a_0+a_1+a_2+\cdots+a_n}^{x} \\
\\
n=\underbrace{1+1+\cdots+1}_{\text{$n$ times}}. \\
\end{align}

Field theory is one of the cornerstones of classical physics. The most notable examples of classical fields are the force fields that one encounters in the description of gravitational and electromagnetic phenomena. These fields are caused by the presence of masses and electric charges, respectively. In this chapter we present a framework for classical field theory, which is known as the Lagrangian formulation. In this formulation the dynamics of a system is described by a single function, the Lagrangian. Via a variational principle the Lagrangian yields the equations of motion which govern the time evolution of that system, so it is a useful mnemonic for summarizing a theory in a concise form. The use of a variational principle to express the equations of classical physics is very old. Fermat’s principle in optics (1657) and Maupertuis’ principle in mechanics (1744) are famous examples.

Apart from its conciseness and its mathematical elegance we mention two important reasons why the Lagrangian formulation is so convenient in field theory. The first one is that the Lagrangian, or rather the integral of the Lagrangian density over space and time, should be invariant under all symmetries of the theory in question. This aspect of the Lagrangian formulation makes it rather attractive for relativistic theories, because it allows one to treat space and time on an equal footing from the very beginning, in contrast to other approaches where one aims directly for a description of the time evolution. The second advantage of the Lagrangian formulation, emphasized by Dirac and elaborated on by Feynman, is that it plays a natural role in the path integral formulation of quantum mechanics. It turns out that the evolution operator for a quantum-mechanical wave function can be expressed as a sum over all paths with fixed endpoints in space-time weighted by a phase factor that depends only on the Lagrangian integrated along the path.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import matplotlib.pyplot as plt
import numpy as np
 
velocity = 100 # velocity in m/sec
angle = 45 # elevation in degrees
rad = 3.14159*angle/180 # convert angle to radians
 
tmax = 2*velocity*np.sin(rad)/9.8 # flight time
times = np.linspace(0, tmax, 100) # 100 time steps from 0 to tmax
 
x = [velocity * np.cos(rad)*t for t in times] # horizontal range
y = [-0.5*9.8*t*t + velocity * np.sin(rad)*t for t in times] # vertical distance
plt.xlabel('Horizontal range [meters]')
plt.ylabel('Vertical distance [meters]')
plt.title('Projectile Trajectory')
plt.grid(True)
 
plt.plot(x, y)
plt.show()

Projectile Trajectory

Leave a Reply

Your email address will not be published. Required fields are marked *

*