So, for one of my university courses, I have to analyse an algorithm on one of my assignments and identify a loop invariant that would allow for a formal proof of algorithmic correctness.
I believe that I identified it in the form of a sum of all of the elements of an array A that have positive values, ranging from 0 to i (where i is the number of time the algorithm has iterated).
I know how to annotate most of that - you write a capital sigma with “k=0” as a subscript and i as a superscript, followed by A[k] but I’m not sure how to specify that I’m only summing the positive elements, so the kth element of A is only added to the sun if it has a positive value.
The lecturer has assured me that that’s not a problem since I can just explain my answer in words, but I still sort of want to know how to do it properly.
Mathematically an array is typically treated as a vector, and is indexed to indicate where in the array/vector you are. You've written $A[k]$ in your question, but I would suggest that, at least for this part of your analysis, you use a subscript instead and let your vector be $A = (A_1, A_2 \ldots ,A_n)$. Each iteration of the vector can then be written as $A^{(k)}$ and any individual element of the $k^{th}$ iterate can be written as $A^{(k)}_j$.
So, with this notation set up, the positive elements of the array are those where $A_j > 0$.
EDIT: from the comments, it's now clear that you want to add the $k^{th}$ element of the array to the overall sum only after $k$ iterations, and if it's positive.
$$\sum_{j=0}^i \max \{0,A^{(j)}_j\}$$ or, if you want to avoid using additional functions (such as $\max$):
$$\sum_{\stackrel{j=0}{A^{(j)}_j >0}} A^{(j)}_j$$
i.e. the sum of those elements of the array $A$ summed if the $k^{th}$ element is positive after $k$ iterations. (If I might offer some additional advice use $T$ for final time rather than $i$).