I have a matlab vector like s=[1 2 3 4]'
and iterate over every element:
for i=1:length(s)
cal_function(s(i));
end
what is the correct mathematic notation of the length
-Function?
I found some papers which write the length as $|s|$ but I don't know if this is correct as I have never seen this before.
Best Answer
That depends on the context. When thinking of vectors, especially in finite-dimensional normed spaces, $\lvert \cdot\rvert$ sometimes is used to denote the norm (though most of the time, $\lVert\cdot\rVert$ is used for that). At those times, the length is usually clear from the context or entirely immaterial.
When talking about abstract tuples, it's almost always the length (number of entries) of the tuple, and I'm not aware of any other common notation.