Demonstrating mathematical equations using LaTeX rendering
The 0/1 Knapsack Problem is a classic optimization problem. Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.
Maximize: $\sum_{i=1}^{n} v_i x_i$
Subject to: $\sum_{i=1}^{n} w_i x_i \leq W$
Where: $x_i \in \{0, 1\}$ for all $i$
$K[i][w] = \max \begin{cases} K[i-1][w] & \text{if } w_i > w \\ \max(K[i-1][w], K[i-1][w - w_i] + v_i) & \text{otherwise} \end{cases}$
Linear regression is a linear approach to modeling the relationship between a scalar response and one or more explanatory variables.
$h_\theta(x) = \theta_0 + \theta_1 x_1 + \theta_2 x_2 + \dots + \theta_n x_n$
Or in vector form: $h_\theta(x) = \theta^T x$
$J(\theta) = \frac{1}{2m} \sum_{i=1}^{m} (h_\theta(x^{(i)}) - y^{(i)})^2$
$\theta_j := \theta_j - \alpha \frac{\partial}{\partial \theta_j} J(\theta)$
$\frac{\partial}{\partial \theta_j} J(\theta) = \frac{1}{m} \sum_{i=1}^{m} (h_\theta(x^{(i)}) - y^{(i)}) x_j^{(i)}$
$\theta = (X^T X)^{-1} X^T y$