[Tex/LaTex] Optimization formulas in LaTeX

equations

This is the code I'm using for my optimization problem.

\begin{equation}
\begin{array}{rrclcl}
\displaystyle \min_{w,b,\xi} & \multicolumn{3}{l}{\frac{1}{2}w^{t}w+C\sum_{i=1}^{N}{\xi_{i}}}\\
\textrm{s.t.} & y_{i}(w\phi(x_{i}+b))+\xi_{i}-1\\
&\xi\geq0    \\
\end{array}
\end{equation}

This is the result:
enter image description here

I want third argument (\xi\geq0) under yi. How can I do that? How can I add i=1 and N under and above summation?

Best Answer

this is very easy to accomplish using the aligned environment from amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
\min_{w,b,\xi} \quad & \frac{1}{2}w^{t}w+C\sum_{i=1}^{N}{\xi_{i}}\\
\textrm{s.t.} \quad & y_{i}(w\phi(x_{i}+b))+\xi_{i}-1\\
  &\xi\geq0    \\
\end{aligned}
\end{equation}
\end{document}

optput of example code

(in the future, please make your code a full compilable example, from \documentclass through \end{document}.)

Related Question