3
$\begingroup$

I'm facing a simple problem actually:

  for (int i = 0; i < noutput_items; i++){     out[i] = in[i] * in[i];   } 

When I want to formalize this as a math expression, how do I issue the limits?

$$\sum_{i=0}^{noutput\_items} in_i$$ was my initial guess, but of course it's not a sum. It's a while ago when I last checked how sequences can be expressed with integrals or as sums... Could somebody help me to refresh my memory :)

Best, Marius

  • 0
    It is extremely unclear what are $\operatorname{in}[i], \operatorname{out}[i]$ and I assume that nooutput_items is a predefined constant, or it is not clear what purpose does the loop serve? I would advise that you post some more parts of the code. This snippet, as it stands is extremely unhelpful!2012-03-26
  • 0
    I'd write something like $\operatorname{out} = \operatorname{in}^2$.2012-03-26
  • 0
    Or $\forall i \in \{0, 1, \ldots, noutput\\_ items-1\}.\ out_i = in_i^2$.2012-03-26

2 Answers 2