This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Algorithms Lecture 2: Fast Fourier Transforms [ Fa10 ] Calvin: Heres another math problem I cant gure out. Whats 9+4? Hobbes: Ooh, thats a tricky one. You have to use calculus and imaginary numbers for this. Calvin: IMAGINARY NUMBERS?! Hobbes: You know, eleventeen, thirtytwelve, and all those. Its a little confusing at rst. Calvin: How did YOU learn all this? Youve never even gone to school! Hobbes: Instinct. Tigers are born with it. Calvin and Hobbes (January 6, 1998) It needs evaluation So let the games begin A heinous crime, a show of force A murder would be nice, of course Bad Horses Letter, Dr. Horribles SingAlong Blog (2008) 2 Fast Fourier Transforms ? 2.1 Polynomials In this lecture well talk about algorithms for manipulating polynomials : functions of one variable built from additions subtractions, and multiplications (but no divisions). The most common representation for a polynomial p ( x ) is as a sum of weighted powers of a variable x : p ( x ) = n X j = a j x j . The numbers a j are called coefcients . The degree of the polynomial is the largest power of x ; in the example above, the degree is n . Any polynomial of degree n can be specied by a sequence of n + 1 coefcients. Some of these coefcients may be zero, but not the n th coefcient, because otherwise the degree would be less than n . Here are three of the most common operations that are performed with polynomials: Evaluate: Give a polynomial p and a number x , compute the number p ( x ) . Add: Give two polynomials p and q , compute a polynomial r = p + q , so that r ( x ) = p ( x )+ q ( x ) for all x . If p and q both have degree n , then their sum p + q also has degree n . Multiply: Give two polynomials p and q , compute a polynomial r = p q , so that r ( x ) = p ( x ) q ( x ) for all x . If p and q both have degree n , then their product p q has degree 2 n . Suppose we represent a polynomial of degree n as an array of n + 1 coefcients P [ 0.. n ] , where P [ j ] is the coefcient of the x j term. We learned simple algorithms for all three of these operations in highschool algebra: E VALUATE ( P [ 0.. n ] , x ) : X 1 X = x j y for j 0 to n y y + P [ j ] X X X x return y A DD ( P [ 0.. n ] , Q [ 0.. n ]) : for j 0 to n R [ j ] P [ j ]+ Q [ j ] return R [ 0.. n ] M ULTIPLY ( P [ 0.. n ] , Q [ 0.. m ]) : for j 0 to n + m R [ j ] for j 0 to n for k 0 to m R [ j + k ] R [ j + k ]+ P [ j ] Q [ k ] return R [ 0.. n + m ] c Copyright 2010 Jeff Erickson. Released under a Creative Commons AttributionNonCommercialShareAlike 3.0 License ( http://creativecommons.org/licenses/byncsa/3.0/ ). Free distribution is strongly encouraged; commercial distribution is expressly forbidden. See http://www.cs.uiuc.edu/~jeffe/teaching/algorithms/ for the most recent revision. 1 Algorithms Lecture 2: Fast Fourier Transforms [ Fa10 ] E VALUATE uses O ( n ) arithmetic operations....
View
Full
Document
This note was uploaded on 10/14/2011 for the course ECON 101 taught by Professor Smith during the Spring '11 term at West Virginia University Institute of Technology.
 Spring '11
 Smith

Click to edit the document details