0
$\begingroup$

I am trying to figure out how to write the summation of a function, $f(t)$, on an interval as mathematical notation. I can only think of the answer in terms of pseudocode, can anyone help me convert the following into mathematical notation?

x = f(0) for (int i = 1; i <= 7; i++) { x(i) = x + f(i); }

Thanks!

edit: Sorry I asked this question wrong. I meant it to be written as each iteration denotes a new value. So, in the case of my problem f(t) is a function of time in days. I want the values to equal the following:

day0 = $f(0)$

day1 = $f(0) + f(1)$

day2 = $f(0) + f(1) + f(2)$

day3 = $f(0) + f(1) + f(2) + f(3)$

day4 = $f(0) + f(1) + f(2) + f(3) + f(4) $

day5 = $f(0) + f(1) + f(2) + f(3) + f(4) + f(5)$

day6 = $f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6)$

day7 = $f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7)$

days 8 $\rightarrow \infty$ = $f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7)$

$\endgroup$
  • 2
    $\begingroup$ $x=\sum_{i=0}^7f(i)$ $\endgroup$ – Jean Marie Mar 9 '17 at 6:45
2
$\begingroup$

Using a for-loop, you are summing up $f(0)$ up to $f(7)$. The pseudo-code is describing $$x=\sum_{i=0}^7 f(i)$$

Edit:

For the edited question:

$$day_i = \sum_{j=0}^{\min(i,7)} f(j)$$

$\endgroup$
  • $\begingroup$ Thank you! Just what I wanted. $\endgroup$ – dawgchow Mar 9 '17 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.