Integer optimization method

38 Views Asked by At

Suppose I have to maximize $f(n)=\displaystyle\sum_{i=0}^n{(2-i)}.$ Which of these two methods is correct (generally, not only for this example)?

1) Since $f(n)=\displaystyle\sum_{i=0}^n{(2-i)}=\displaystyle\frac{(4-n)(n+1)}{2}.$ Then I assume that $x=n$ is continuous and solve:

$g(x)=\displaystyle\frac{(4-x)(x+1)}{2}$ and its maximum is attained at $x=1.5$ then I simply need to check the values of $f(n)$ for $n=1$ and $n=2.$

2) Since I assume $x$ is continuous then the original equation must be $f(x)=\displaystyle\int_{0}^{x}(2-t)dt=\displaystyle\frac{(4-x)x}{2}$and its maximum is attained at $x=2$ therefore the maximum of the original problem is $n=2.$.