Notes for COT 5405 - UCF Computer Science



COT 5405: Design and Analysis of Algorithms 

Lecture 1 ~ August 26, 2003:

Mr. Arup Guha

Conditional Sums

Definition:

[pic] Sum of all elements for which P(i) is true.

P(i) 

Example:

[pic]

[pic] This is for the series of all odd numbers

 

Series

Arithmetic Series

Definition: An Arithmetic Series is a series where the difference between the numbers in the series is constant. 

e.g: 3,5,7,---

where the difference d = 2. Let a1, a2, ... an, be an arithmetic series with difference d, then

Formula for finding the last term:

[pic] where d = difference between terms 

One way to find the sum of an arithmetic sequence is as follows:

[pic]

Take the average term and multiply it by the number of terms n:

[pic]

Note: This technique of find the average value of a term ONLY works because each value in the sum is "spaced out evenly." The proof of the formula for the sum shown in class is the more proper way of arriving at this result. (This proof involved writing down the sum twice, once backwards, then showing that each of the n columns summed to a1 + an.

 Important Formulas: 

1) [pic]

2) [pic]

3) [pic]

Geometric Series: 

Common Ratio (r):

[pic]

where r ≠ 1

Example: Given a geometric sequence with the first term 2 and a common ratio of 3, which term in the sequence is equal to 192?

[pic]

Infinite Geometric Series:

If | r | < 1,then the series has a finite sum and the terms successively approach 0. We can determine this sum by using the formula for a finite geometric sequence and taking its limit as n approaches infinity. In this situation rn approaches 0 so the actual sum of an infinite geometric sequence is a1/(1-r).

Example:

[pic]

lim

[pic]

[pic]

[pic]

L’Hopital’s Rule:

lim

[pic]

Both functions have to be differentiable for all values to ∞ and defined on a range: [c,∞], and g(x) ≠ 0

Example of a sequence that is neither arithmetic nor geometric:

[pic]

[pic]

If we subtract S/2 from S, we get the following series:

[pic]

Denominator follows the Geometric Sequence, while the Numerators are all “1”.

The sum would be as follows using the rule for finding the sum of a Geometric Series now that the problem has been reduced to a simple Geometric series.

Sum = [pic] first term = 1, r = [pic]

Sum =[pic]

Another way to come to this solution would be as follows:

[pic]

Take the Derivative of both sides of the equation:

[pic]

[pic]

[pic]

The next few techniques are for sums of series that are not of Arithmetic or Geometric Origins:

Telescoping Sum

Start with something like this:

[pic]

Which can be simplified to this using the rules of factorials:

[pic]

When k=1, while evaluating (k+1)!-k!, the following results:

[pic]

[pic]

–1! + (n + 1)!

It can be seen how the summation simplifies to only the first and last terms of the series, as all other terms in between will be canceled out no matter the number of terms. The function is our factorial f(x) = x! :

[pic]

Another way to look at this is using a change of index method, where the first step is to break our summation into two separate sums:

[pic]

Now let j=k+1 for the first sum as well as adjust the value of n accordingly, and change the index from k to j on the second sum:

[pic]

This can be simplified to the following summation when the extra n term on the first sum and the first term of the second sum are separated as follows:

1. [pic] 2. [pic]

Now the terms in the square brackets will cancel each other out leaving behind the two terms (n+1)! and 1!, which corresponds with the first solution.

Bounding Summations

With this method, it is necessary to find a term that is either greater than or less than the term being evaluated. This new term might be easier to calculate a solution for. So for a function f:

[pic]

As a note, the only time that this inequality would reach equality would be in the case that all terms in the series are equal. Another way to represent this in a more simplified form:

[pic] if g(i) > f(i) for all i, and if h(i) < f(i) for all i.

Now consider two examples, first:

Ex:[pic]

We can bound the sum from below, substituting the minimum term in the entire series for each term. This minimum term is achieved for i=2k+1, since successive terms in the sequence are decreasing. Thus, we have:

[pic]

When i is not part of the term being summed, it is a constant being added to itself multiple times. The equation used for determining the number of times to use this term is (last – first + 1)*constant. This will give us the sum of the second summation.

[pic] distribute the negative sign: [pic]

This will reduce our expression to:

[pic]

After performing some algebra, the expression can be simplified to a number:

[pic]

The second example utilizes the Harmonic Series

[pic]

We will prove the following assertion for positive integers n:

[pic]

This time smaller terms will be used to demonstrate bounding summations. In this case, all of the terms of 1/2i will be smaller than the terms of the original series, which satisfies the original statement made about bounding summations.

[pic] [pic]

From this, a ½ can be factored out, leaving the Harmonic Series:

[pic]

Bound By Integral

With this example, again the Harmonic series will be utilized.

[pic]

Now each of these terms will be represented on a graph as a rectangle, with the first rectangle being a 1x1, and the next 1/2 of the original’s size, then 1/3 of the original’s size, and so forth. Next the following function will be graphed over the rectangles:

[pic]

This shows that the rectangles are contained under the curve, meaning that the area under the function represented by that curve will bound our series summation. The area under the curve, or the definite integral of f(x) from 1 to n will be greater than the combined summation of areas of the rectangles. In order to prevent have to take a natural logarithm of zero, the first rectangle is calculated in advance, otherwise our definite integral would not be uncomputable.

[pic]

After integration, the result is:

[pic]

n = 1 would be the only case where there would be an equality, rather than the Harmonic Series being less than natural logarithm of the function + 1.

-----------------------

[pic]

[pic]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download