COP3502_15_Summations

# COP3502_15_Summations - Fun With Summations Computer...

This preview shows pages 1–6. Sign up to view the full content.

Computer Science Department University of Central Florida Fun With Summations COP 3502 – Computer Science I

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Fun With Summations page 2 Summations Is this a Math class? Why do we study summations? In order to effectively approximate algorithms We NEED mathematical tools It is not always as simply as doing a 4 second examination of a for loop and deciphering the Big-O time So for iterative algorithms We use summations as the tool (discussed today) For recursive algorithms, this doesn’t work We need yet another tool Recurrence relations (coming after the exam)
Fun With Summations page 3 Summations Definition: In very basic terms, a summation is the addition of a set of numbers. Example: Let’s say we want to sum the integers from 1 to 5 Here, the “i” is just a variable. Let’s look at this notation in more detail… = 5 1 i i 5 4 3 2 1 + + + + = 15 =

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Fun With Summations page 4 Summations A summation: or is like a for loop:         for ( int j = m; j <= n; j++ )              sum += f(j); = n m j j f ) ( ) ( j f n index of upper limit lower limit Here, f(j) is simply a function in terms of j Just like f(x) = 2x+1 is a function in terms of x. f(j) is simply some function in terms of j. So what is f(j)?
Fun With Summations page 5 Summations Example con’d: Since “i” is just a variable, we can use any variable name… We also recognize that a summation is merely summing (adding) the values of some given function This far, we’ve only looked at this most simply function: f(i) = i And then we summed up those i terms.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 09/21/2011.

### Page1 / 22

COP3502_15_Summations - Fun With Summations Computer...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online