math-formulas.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /* eslint-disable no-irregular-whitespace */
  2. // Math Formulas Content
  3. export const MATH_FORMULAS_MD = String.raw`
  4. # Mathematical Formulas and Expressions
  5. This document demonstrates various mathematical notation and formulas that can be rendered using LaTeX syntax in markdown.
  6. ## Basic Arithmetic
  7. ### Addition and Summation
  8. $$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$
  9. ## Algebra
  10. ### Quadratic Formula
  11. The solutions to $ax^2 + bx + c = 0$ are:
  12. $$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
  13. ### Binomial Theorem
  14. $$(x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k$$
  15. ## Calculus
  16. ### Derivatives
  17. The derivative of $f(x) = x^n$ is:
  18. $$f'(x) = nx^{n-1}$$
  19. ### Integration
  20. $$\int_a^b f(x) \, dx = F(b) - F(a)$$
  21. ### Fundamental Theorem of Calculus
  22. $$\frac{d}{dx} \int_a^x f(t) \, dt = f(x)$$
  23. ## Linear Algebra
  24. ### Matrix Multiplication
  25. If $A$ is an $m \times n$ matrix and $B$ is an $n \times p$ matrix, then:
  26. $$C_{ij} = \sum_{k=1}^{n} A_{ik} B_{kj}$$
  27. ### Eigenvalues and Eigenvectors
  28. For a square matrix $A$, if $Av = \lambda v$ for some non-zero vector $v$, then:
  29. - $\lambda$ is an eigenvalue
  30. - $v$ is an eigenvector
  31. ## Statistics and Probability
  32. ### Normal Distribution
  33. The probability density function is:
  34. $$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$
  35. ### Bayes' Theorem
  36. $$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$
  37. ### Central Limit Theorem
  38. For large $n$, the sample mean $\bar{X}$ is approximately:
  39. $$\bar{X} \sim N\left(\mu, \frac{\sigma^2}{n}\right)$$
  40. ## Trigonometry
  41. ### Pythagorean Identity
  42. $$\sin^2\theta + \cos^2\theta = 1$$
  43. ### Euler's Formula
  44. $$e^{i\theta} = \cos\theta + i\sin\theta$$
  45. ### Taylor Series for Sine
  46. $$\sin x = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!} x^{2n+1} = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots$$
  47. ## Complex Analysis
  48. ### Complex Numbers
  49. A complex number can be written as:
  50. $$z = a + bi = r e^{i\theta}$$
  51. where $r = |z| = \sqrt{a^2 + b^2}$ and $\theta = \arg(z)$
  52. ### Cauchy-Riemann Equations
  53. For a function $f(z) = u(x,y) + iv(x,y)$ to be analytic:
  54. $$\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}, \quad \frac{\partial u}{\partial y} = -\frac{\partial v}{\partial x}$$
  55. ## Differential Equations
  56. ### First-order Linear ODE
  57. $$\frac{dy}{dx} + P(x)y = Q(x)$$
  58. Solution: $y = e^{-\int P(x)dx}\left[\int Q(x)e^{\int P(x)dx}dx + C\right]$
  59. ### Heat Equation
  60. $$\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2}$$
  61. ## Number Theory
  62. ### Prime Number Theorem
  63. $$\pi(x) \sim \frac{x}{\ln x}$$
  64. where $\pi(x)$ is the number of primes less than or equal to $x$.
  65. ### Fermat's Last Theorem
  66. For $n > 2$, there are no positive integers $a$, $b$, and $c$ such that:
  67. $$a^n + b^n = c^n$$
  68. ## Set Theory
  69. ### De Morgan's Laws
  70. $$\overline{A \cup B} = \overline{A} \cap \overline{B}$$
  71. $$\overline{A \cap B} = \overline{A} \cup \overline{B}$$
  72. ## Advanced Topics
  73. ### Riemann Zeta Function
  74. $$\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} = \prod_{p \text{ prime}} \frac{1}{1-p^{-s}}$$
  75. ### Maxwell's Equations
  76. $$\nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0}$$
  77. $$\nabla \cdot \mathbf{B} = 0$$
  78. $$\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}$$
  79. $$\nabla \times \mathbf{B} = \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}$$
  80. ### Schrödinger Equation
  81. $$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
  82. ## Inline Math Examples
  83. Here are some inline mathematical expressions:
  84. - The golden ratio: $\phi = \frac{1 + \sqrt{5}}{2} \approx 1.618$
  85. - Euler's number: $e = \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n$
  86. - Pi: $\pi = 4 \sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}$
  87. - Square root of 2: $\sqrt{2} = 1.41421356...$
  88. ## Fractions and Radicals
  89. Complex fraction: $\frac{\frac{a}{b} + \frac{c}{d}}{\frac{e}{f} - \frac{g}{h}}$
  90. Nested radicals: $\sqrt{2 + \sqrt{3 + \sqrt{4 + \sqrt{5}}}}$
  91. ## Summations and Products
  92. ### Geometric Series
  93. $$\sum_{n=0}^{\infty} ar^n = \frac{a}{1-r} \quad \text{for } |r| < 1$$
  94. ### Product Notation
  95. $$n! = \prod_{k=1}^{n} k$$
  96. ### Double Summation
  97. $$\sum_{i=1}^{m} \sum_{j=1}^{n} a_{ij}$$
  98. ## Limits
  99. $$\lim_{x \to 0} \frac{\sin x}{x} = 1$$
  100. $$\lim_{n \to \infty} \left(1 + \frac{x}{n}\right)^n = e^x$$
  101. ## Further Bracket Styles and Amounts
  102. - \( \mathrm{GL}_2(\mathbb{F}_7) \): Group of invertible matrices with entries in \(\mathbb{F}_7\).
  103. - Some kernel of \(\mathrm{SL}_2(\mathbb{F}_7)\):
  104. \[
  105. \left\{ \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} -1 & 0 \\ 0 & -1 \end{pmatrix} \right\} = \{\pm I\}
  106. \]
  107. - Algebra:
  108. \[
  109. x = \frac{-b \pm \sqrt{\,b^{2}-4ac\,}}{2a}
  110. \]
  111. - $100 and $12.99 are amounts, not LaTeX.
  112. - I have $10, $3.99 and $x + y$ and $100x$. The amount is $2,000.
  113. - Emma buys 2 cupcakes for $3 each and 1 cookie for $1.50. How much money does she spend in total?
  114. - Maria has $20. She buys a notebook for $4.75 and a pack of pencils for $3.25. How much change does she receive?
  115. - 1 kg の質量は
  116. \[
  117. E = (1\ \text{kg}) \times (3.0 \times 10^8\ \text{m/s})^2 \approx 9.0 \times 10^{16}\ \text{J}
  118. \]
  119. というエネルギーに相当します。これは約 21 百万トンの TNT が爆発したときのエネルギーに匹敵します。
  120. - Algebra: \[
  121. x = \frac{-b \pm \sqrt{\,b^{2}-4ac\,}}{2a}
  122. \]
  123. - Algebraic topology, Homotopy Groups of $\mathbb{S}^3$:
  124. $$\pi_n(\mathbb{S}^3) = \begin{cases}
  125. \mathbb{Z} & n = 3 \\
  126. 0 & n > 3, n \neq 4 \\
  127. \mathbb{Z}_2 & n = 4 \\
  128. \end{cases}$$
  129. - Spacer preceded by backslash:
  130. \[
  131. \boxed{
  132. \begin{aligned}
  133. N_{\text{att}}^{\text{(MHA)}} &=
  134. h \bigl[\, d_{\text{model}}\;d_{k} + d_{\text{model}}\;d_{v}\, \bigr] && (\text{Q,K,V の重み})\\
  135. &\quad+ h(d_{k}+d_{k}+d_{v}) && (\text{バイアス Q,K,V)}\\[4pt]
  136. &\quad+ (h d_{v})\, d_{\text{model}} && (\text{出力射影 }W^{O})\\
  137. &\quad+ d_{\text{model}} && (\text{バイアス }b^{O})
  138. \end{aligned}}
  139. \]
  140. ## Formulas in a Table
  141. | Area | Expression | Comment |
  142. |------|------------|---------|
  143. | **Algebra** | \[
  144. x = \frac{-b \pm \sqrt{\,b^{2}-4ac\,}}{2a}
  145. \] | Quadratic formula |
  146. | | \[
  147. (a+b)^{n} = \sum_{k=0}^{n}\binom{n}{k}\,a^{\,n-k}\,b^{\,k}
  148. \] | Binomial theorem |
  149. | | \(\displaystyle \prod_{k=1}^{n}k = n! \) | Factorial definition |
  150. | **Geometry** | \( \mathbf{a}\cdot \mathbf{b} = \|\mathbf{a}\|\,\|\mathbf{b}\|\,\cos\theta \) | Dot product & angle |
  151. ## No math (but chemical)
  152. Balanced chemical reaction with states:
  153. \[
  154. \ce{2H2(g) + O2(g) -> 2H2O(l)}
  155. \]
  156. The standard enthalpy change for the reaction is: $\Delta H^\circ = \pu{-572 kJ mol^{-1}}$.
  157. ---
  158. *This document showcases various mathematical notation and formulas that can be rendered in markdown using LaTeX syntax.*
  159. `;