# It involves summation optimization

My target function is as follows：

Optimize the sum of n from 1 to 100.What I’ve written is the sum of 100 optimizations.I’d like to ask for the correct code.I would appreciate it

I have no idea what that notation means, so I leave you to sort through that. But here are some pointers.

`inv_pos` can be used on vector arguments, producing a vector output, which can then be summed.
For instance, `sum(-inv_pos(cvx_vector))`

CVX also allows you to build up expressions. For instance

``````objective_sum = 0;
for i=1:n
objective_sum = objective_sum + ith_term;
end
maximize(objective_sum + some_other_term)
``````

help inv_pos

inv_pos Reciprocal of a positive quantity.
inv_pos(X) returns 1./X if X is positive, and +Inf otherwise.
X must be real.

`````` For matrices and N-D arrays, the function is applied to each element.

Disciplined convex programming information:
inv_pos is convex and nonincreasing; therefore, when used in CVX
specifications, its argument must be concave (or affine).``````

Thank you very much for your answer. According to what you said, I solved my problem