# How would you write this set of linear programming problems as latex? [closed]

I am not able to make myself understood over at Mathematics Stackexchange in this question.

Therefore I ask here the Latex experts how to write these linear programming problems as latex, the standard way of communicating mathematics at the stack exchange network:

Linear programming problem written in Mathematica 8.0:

(*start*)
nn = 18;
TableForm[
L2 = Table[
LinearProgramming[
Table[1/n, {n, 1, k}], {Table[If[n == 1, k, 1], {n, 1, k}]}, {{1,
0}}, Table[
If[n == 1, {-1, 1}, {-2 (n - 1), 0 (n - 1)}], {n, 1, k}]], {k,
1, nn}]]
(*end*)


Here is my own try:

$$\begin{array}{ll} \text{minimize} & \displaystyle\sum_{n=1}^{n=k} \frac{x_{n}}{n} \\ \text{subject to constraints:} & k + \displaystyle\sum_{n=2}^{n=k}x_{n}=1 \\ & x_1 \geq -1 \end{array}$$

for all $k$ and for all $n>1:$
$$-2(n-1) \leq x_n \leq 0 \tag{4}$$


For some reason the latex above does not parse here on the Latex site. Maybe someone can edit appropriately, before I find it out myself how to write latex here?

## closed as off-topic by Stefan Pinnow, Phelype Oleinik, barbara beeton, Raaja, schtandardJun 22 at 16:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Stefan Pinnow, Phelype Oleinik, barbara beeton, Raaja, schtandard
If this question can be reworded to fit the rules in the help center, please edit the question.

• to show latex output, clip a screenshot of your pdf viewer and upload the image. – David Carlisle Jun 22 at 12:03
• Yes they run MathJax on the mathematica site but it is not enabled here as it would be confusing as we need to see tex output. – David Carlisle Jun 22 at 12:05
• I added a screen shot – Mats Granvik Jun 22 at 12:05
• Are you asking how to write this in latex or are you asking how to write this in mathjax, which is used on math.se – gigi Jun 22 at 12:16

You have a dedicated package for optimisation problems: optidef. Does this befit you?

\documentclass{article}
\usepackage{optidef}

\begin{document}

\setcounter{equation}{3}
\begin{mini}
{x}{\sum_{n=1}^{n=k} \frac{x_{n}}{n}}{\label{mylinpb}}{}