Test examples of complex expressions
(1) Task (chemistry): Expression for the equilibrium constant of a reaction written using ion activities.
\( \log K = \log \left( \frac{ a_{NH_4^+}^{\,\nu_1} a_{SO_4^{2-}}^{\,\nu_2} a_{H_2O}^{\,\nu_3} a_{Cl^-}^{\,\nu_4} }{ a_{NH_3}^{\,\nu_5} a_{H_2SO_4}^{\,\nu_6} a_{Na^+}^{\,\nu_7} } \right) \)(2) Task (physics): Euler–Lagrange equations of motion for a system with N coordinates.
\( \sum_{i=1}^{N} \left[ \frac{d}{dt} \left( \frac{\partial L}{\partial \dot q_i} \right) - \frac{\partial L}{\partial q_i} \right] = \sum_{i=1}^{N} Q_i \)(3) Task (mathematics): Taylor expansion of a function around the point a up to the n-th order.
\( f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \frac{f'''(a)}{3!}(x-a)^3 + \frac{f^{(4)}(a)}{4!}(x-a)^4 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n \)(4) Task (computer science): One representation of the discrete Fourier transform used in the FFT algorithm.
\( \sum_{k=0}^{n-1} \left( \left( W_N^{k} \sum_{m=0}^{N/2-1} x_{2m} W_{N/2}^{mk} \right) + \left( W_N^{k+N/2} \sum_{m=0}^{N/2-1} x_{2m+1} W_{N/2}^{mk} \right) \right) \)(5) Task (test of a very long formula): Analytical expression combining polynomial expansion, trigonometric terms, and a sum – used for testing automatic line breaking of formulas.
\( f(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + a_9 x^9 + \sum_{k=1}^{20} \left( b_k \sin(kx) + c_k \cos(kx) \right) + \frac{1}{1+x} + \frac{1}{1+x^2} + \frac{1}{1+x^3} + \frac{1}{1+x^4} + \frac{1}{1+x^5} \)(6) Task (mathematics – very long formula): General Fourier expansion of a function with multiple harmonics.
\( f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \left( a_n \cos\left(\frac{2\pi n x}{T}\right) + b_n \sin\left(\frac{2\pi n x}{T}\right) \right) + \sum_{k=1}^{10} \left( \frac{c_k}{k^2 + x^2} + \frac{d_k x}{k^2 + x^2} \right) \)(7) Task (physics – quantum mechanics): General form of the Schrödinger equation with potential and additional terms.
\( i\hbar \frac{\partial \Psi(x,t)}{\partial t} = - \frac{\hbar^2}{2m} \frac{\partial^2 \Psi(x,t)}{\partial x^2} + V(x)\Psi(x,t) + \alpha x^2 \Psi(x,t) + \beta x^4 \Psi(x,t) + \gamma \sin(x)\Psi(x,t) + \delta \cos(x)\Psi(x,t) \)(8) Task (computer science – statistics and machine learning): Logistic regression loss function with regularization.
\( J(\theta) = - \frac{1}{m} \sum_{i=1}^{m} \left[ y^{(i)} \log(h_\theta(x^{(i)})) + (1-y^{(i)})\log(1-h_\theta(x^{(i)})) \right] + \frac{\lambda}{2m} \sum_{j=1}^{n} \theta_j^2 + \alpha \sum_{k=1}^{n} |\theta_k| \)(9) Task (extreme MathJax test): Combination of integrals, sums, matrices, and fractions to test automatic line breaking of a very long formula.
\( F(x) = \int_{0}^{\infty} \left( \sum_{n=1}^{\infty} \frac{ a_n x^n + b_n \sin(nx) + c_n \cos(nx) }{ 1 + n^2 x^2 } \right) e^{-x^2} dx + \sum_{k=1}^{10} \sqrt{ \frac{ k^2 + x^2 + \sin^2(x) + \cos^2(x) }{ 1 + x^4 + k^4 } } + \begin{pmatrix} x & x^2 & x^3 & x^4 \\ \sin x & \cos x & \tan x & e^x \\ \ln(1+x) & \sqrt{x} & \frac{1}{1+x} & \frac{x}{1+x^2} \end{pmatrix} \)(10) Task (MathJax benchmark – extremely long formula): Combination of multiple integrals, sums, products, derivatives, and matrices to test the maximum load of the renderer.
\( G(x,t) = \int_{0}^{\infty} \int_{0}^{\infty} \left( \sum_{n=1}^{\infty} \frac{ \partial^{\,n}}{\partial x^{n}} \left( \frac{x^n e^{-xt}}{1+n^2} \right) + \prod_{k=1}^{5} \left( 1 + \frac{x^2}{k^2+t^2} \right) \right) e^{-(x^2+t^2)} \,dx\,dt + \sum_{m=1}^{20} \frac{ \sqrt{ m^2 + x^2 + \sin^2(x) + \cos^2(x) } }{ 1 + m^4 + x^4 } + \begin{pmatrix} x & x^2 & x^3 & x^4 & x^5 \\ \sin x & \cos x & \tan x & e^x & \ln(1+x) \\ \sqrt{x} & \frac{1}{1+x} & \frac{x}{1+x^2} & \arctan x & \sinh x \end{pmatrix} \cdot \begin{pmatrix} 1 \\ x \\ x^2 \\ \sin x \\ \cos x \end{pmatrix} \)Podijelite vježbu: