I don't understand the sigma notation and for loop

后端 未结 7 520
忘掉有多难
忘掉有多难 2021-01-05 04:10

I have the book saying that

\"enter

and says that this is equivalent to saying

7条回答
  •  鱼传尺愫
    2021-01-05 04:29

    I think that we have limitations for calculating For loops through Sigma notation

    for example

    x=0
    For i=2 to n-1 do
        For j=i+1 To n-2 do
              x=x+1
    

    for n=5 we have x=1

    but when I calculate it by Sigma

    Sigma i=2 to n-1 (Sigma j=i+1 to n-2)= (n^2 -7*n+10 )/2

    if we substitute n=5 then answer is zero, Why?

提交回复
热议问题