testing features
let’s test if everything works properly with math, code, and formatting.
inline math
here’s some inline math: E = mc2 and the quadratic formula $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.
display math
the gaussian integral:
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
matrix multiplication:
$$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}$$
physics equations
the schrödinger equation:
$$i\hbar \frac{\partial}{\partial t}\Psi = \hat{H}\Psi$$
maxwell’s equations:
$$\nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0}$$
$$\nabla \times \mathbf{B} - \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t} = \mu_0 \mathbf{J}$$
complex examples
euler’s identity:
eiπ + 1 = 0
a sum:
$$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$
an integral with limits:
$$\int_0^1 x^2 dx = \frac{1}{3}$$
code blocks
python should be properly highlighted:
def fibonacci(n):
"""Return the nth Fibonacci number."""
if n <= 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
# calculate first 10 fibonacci numbers
for i in range(10):
print(f"fibonacci({i}) = {fibonacci(i)}")rust code:
fn main() {
let mut vec = vec![1, 2, 3, 4, 5];
vec.iter()
.map(|x| x * 2)
.filter(|x| x > &5)
.for_each(|x| println!("{}", x));
}block quotes
if the individual lived five hundred or one thousand years, this clash might not exist or at least might be considerably reduced. he then might live and harvest with joy what he sowed in sorrow.
lists
unordered list:
- first item
- second item with bold text
- third item with italic text
ordered list:
- first item
- second item with
inline code - third item
tables
| column 1 | column 2 | column 3 |
|---|---|---|
| cell 1,1 | cell 1,2 | cell 1,3 |
| cell 2,1 | cell 2,2 | cell 2,3 |
| cell 3,1 | cell 3,2 | cell 3,3 |
mixed content
combining math and code: the fibonacci sequence can be expressed as Fn = Fn − 1 + Fn − 2 with base cases F0 = 0 and F1 = 1.
here’s a function that uses memoization:
const fib = (n, memo = {}) => {
if (n in memo) return memo[n];
if (n <= 1) return n;
memo[n] = fib(n - 1, memo) + fib(n - 2, memo);
return memo[n];
};the time complexity is reduced from O(2n) to O(n) using dynamic programming.