Analyzing Recurrence Relations: Help with Summations Code

  • Thread starter Thread starter EvLer
  • Start date Start date
  • Tags Tags
    Code
AI Thread Summary
The discussion focuses on analyzing a nested loop structure represented by a recurrence relation and transitioning it into summations. The original code iterates through three nested loops, leading to a complexity analysis involving summations. Participants clarify the correct formulation of these summations, emphasizing the need to adjust terms correctly, particularly regarding the indices. There is a specific focus on how to express the summation in terms of n and i, with corrections made to initial assumptions about the expressions used. The conversation concludes with encouragement to further explore the summation breakdown for clarity and accuracy.
EvLer
Messages
454
Reaction score
0
Hi everyone,
I have the following recurrence to represent in terms of n:
Code:
  n-1    n      j
Sigma Sigma Sigma(c1) =...
 i =1  j = i+1 k=1
Basically, it is an analysis of following code:
Code:
for(i = 1 to n -1)
   for(j = i+1 to n)
       for(k = 1 to j)
      something of O(1)
So, I came up with summations but not sure how to switch to n.
So far I have following:
Code:
 n-1    n                    n-1    n            n-1      n       
Sigma Sigma (c1)(j-1) = c1 Sigma Sigma   j  - c1 Sigma Sigma 1;  
 i=1  j=i+1                 i=1   j=i+1          i=1   j=i+1
Second part resulted in c1[n(n-1) - [n(n+1)]/2 - (n-1)]; but I am stuck on the first part. Should I regard j = i + 1 as some constant?

Thanks a lot.
 
Last edited:
Physics news on Phys.org
You shouldn't have "j - 1" you should just have j, i.e.

\sum _{i = 1} ^{n - 1}\sum _{j = i + 1} ^n \sum _{k = 1} ^j c_1 = \sum _{i = 1} ^{n - 1}\sum _{j = i + 1} ^n jc_1

Now:

\sum _{i = 1} ^{n - 1}\sum _{j = i + 1} ^n jc_1 = \sum _{i = 1} ^{n - 1}\left (\sum _{j = 1} ^n jc_1 - \sum _{j = 1} ^i jc_1\right ) = c_1 \sum_{i = 1} ^{n - 1}\left (\frac{n(n + 1)}{2} - \frac{i(i - 1)}{2}\right )

See if you can go from there.
 
Thanks a lot for the reply.
I have some questions on your solution though:
how did you come up with i(i-1)/2 for the second expression in the parenthesis but n(n+1)/2 for the first? I know there is a minus before the i-expression but is it affecting the inner i-parenthesis?
From where you left off, I am thinking of breaking off the summation into two: one dependent on n and other dependent on i, is this the right direction?

Again, thank you very much.
 
Sorry, that was just a typo. It should be n(n+1)/2, and i(i+1)/2. As for the rest, I'm sure you can figure out the right direction without me telling you.
 
I multiplied the values first without the error limit. Got 19.38. rounded it off to 2 significant figures since the given data has 2 significant figures. So = 19. For error I used the above formula. It comes out about 1.48. Now my question is. Should I write the answer as 19±1.5 (rounding 1.48 to 2 significant figures) OR should I write it as 19±1. So in short, should the error have same number of significant figures as the mean value or should it have the same number of decimal places as...
Thread 'Calculation of Tensile Forces in Piston-Type Water-Lifting Devices at Elevated Locations'
Figure 1 Overall Structure Diagram Figure 2: Top view of the piston when it is cylindrical A circular opening is created at a height of 5 meters above the water surface. Inside this opening is a sleeve-type piston with a cross-sectional area of 1 square meter. The piston is pulled to the right at a constant speed. The pulling force is(Figure 2): F = ρshg = 1000 × 1 × 5 × 10 = 50,000 N. Figure 3: Modifying the structure to incorporate a fixed internal piston When I modify the piston...
Thread 'A cylinder connected to a hanging mass'
Let's declare that for the cylinder, mass = M = 10 kg Radius = R = 4 m For the wall and the floor, Friction coeff = ##\mu## = 0.5 For the hanging mass, mass = m = 11 kg First, we divide the force according to their respective plane (x and y thing, correct me if I'm wrong) and according to which, cylinder or the hanging mass, they're working on. Force on the hanging mass $$mg - T = ma$$ Force(Cylinder) on y $$N_f + f_w - Mg = 0$$ Force(Cylinder) on x $$T + f_f - N_w = Ma$$ There's also...
Back
Top