References
- Simple MathJax Plug-in for WordPress
- MathJax basic tutorial and quick reference
- MathJax in WordPress and LaTeX for Math Blogs by Yu Tsumura, Math dept., Ohio State University
- LaTeX:Symbols Art of Problem Solving
At first, we sample
where
Then we interpolate points
Its coefficients
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
1 | the book costs \ $ 1.00; the area is $x^2y^2$ feet |
In-line mode:
1 | $ \sum_ {i=0}^n i^2 = \dfrac {(n^2+n)(2n+1)}{6}$ |
Display mode:
1 | $$ \sum_ {i=0}^n i^2 = \dfrac {(n^2+n)(2n+1)}{6}$$ |
Begin Align Equations
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} |
123456789$$\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
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
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
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
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.
1 2 3 4 5 6 7 | \begin{equation} e=mc^2 \end{equation} \begin{equation*} F = ma \end{equation*} |
Example: equation* in LaTeX
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
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
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
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
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
C
{3,4,5}
{3,5}
{1}
{1,6}
{1,2,3}
{1,2,3,4}
{1,2,6}
x
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
1 | $$ \cfrac {2}{1+ \cfrac {2}{1+ \cfrac {2}{1+ \cfrac {2}{1}}}}$$ |
An Identity from Ramanujan (using continued fractions)
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 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
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
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
Equation
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
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
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)
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 ] $ |
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
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
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} |
Markdown Block References
Example of List
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.
12345678910111213141516171819import
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()