/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q9E Practice with polynomial multipl... [FREE SOLUTION] | 91影视

91影视

Practice with polynomial multiplication by FFT.

(a) Suppose that you want to multiply the two polynomials x + 1 and x2+1using the FFT. Choose an appropriate power of two, find the FFT of the two sequences, multiply the results component wise, and compute the inverse FFT to get the final result.

(b) Repeat for the pair of polynomials 1+x+2x2and 2 + 3x.

Short Answer

Expert verified
  1. FTT of two sequence: (4,0,0,0)
  2. FTT of two sequence: ( 20, - 5 -i, -2 , - 5 +i )

Step by step solution

01

Solution of part (a)

Multiplication of polynomials by Fast Fourier Transform (FFT):

Fast Fourier Transform (FFT):

The 44matrix of FFT is,

localid="1659009189962" M4'=111112312361369.....(1)

The difficult result of a nth fundamental plus unity is,

'=e2蟺颈n 鈥︹ (2)

Alternative in Equations, the value of " n " is " 4 " (2). As a result, the value of is

'=e2蟺颈4=ei2

Note: eix=cos(x)+isin(x)

Thus, e蟺颈2has already been prepared in accordance with the information provided:

=cos2+isin2=cos(90)+isin(90)=0+i(1)=i...........(3)

Alternative Equation (3) in Equation (1).

M4'=11111ii2i31i2i3i61i3i6i9.....(4)

In general, the value of i,i2,i3,i4are,

i=ii2=-1i3=-ii4=1 ...........(5)

The counting value of i6,i9is,

i6=i4i2=-1i9=i6i3=i 鈥︹ (6)

Alternative counting values are i,i2,i3,i4,i6,i9in Equation (4). The FFT matrix is,

M4'=11111i-1-i1-11-11-i-1i.....(7)

Polynomial multiplication:

Question now been written in accordance with the information provided.

A(x)=a0+a1x+....+adxd.....(8)

The first polynomial is x + 1 鈥︹ (9)

Similarity equations (8) and (9),

a0=1,a1=1,a2=0anda3=0.....(10)

Considering the polynomials into matrix transformation formula..

localid="1659009567989" A=a0a1a2a3 鈥︹ (11)

2nd part of the above values of a0,a1,a2,a3 in Equation (11).

A=1100...(12)

The FFT of A ( 1, 1, 0, 0 )is calculated as follows:

FFT of A=M4A..........(13)

Substitute the values M4from Equation (7) and A from Equation (12) in Equation (13).

=11111i-1-i1-11-11-i-1i*1000

=1+1+0-01+i+0+01-1+0+01-i+0+0FFTofA=2i+10i-1....(14)

The 2nd polynomial is x2+1 鈥︹ (15)

equal equations (8) and (15)

a0=1a1=0a2=1........(16)a3=0

Take a look there at formula on converting a polynomial to something like a matrix..

localid="1659011072851" B=a0a1a2a3 鈥︹ (17)

Alternative the above values of a0,a1,a2,a3in Equation (17).

B=1010 鈥︹ (18)

The FFT of B ( 1,0,1,0) is calculated as follows:

FFTofB=M4B鈥︹ (19)

Within Equations (7), replace all values of Equation (18) with M4(w) the values from Equation (7). (19).

localid="1659067306314" TheFFTofB=11111i-1-i1-11-11-i-1i1010=1+0+1+01+0-1+01+0+1+01+0+1+0FFTofB=2020............(20)

This polynomial's combination is. X+1and x2 +1 is

Product = (X+1) * (x2 +1)

= x3 + x + x2 +1

= 1 + x + x2+ x3 鈥︹ (21)

Let the product of FFT of A and B be P. The product is calculated as shown below:

P = A * B 鈥︹ (22)

,

Substitute the value of 鈥 A鈥 from Equation (14) and 鈥B鈥 from Equation (20) in Equation (22).

P=2i+10i-1*2020=4000(23)

Inverse FFT:

Use the inverse FFT, which equals Inverse FFT, to get the final result. FFT=1n Mn(w-1) 鈥︹ (24)

Here, from Equation (3), the value of =iThus, the value of -1is:

-1=(i)-1=cos2+isin2-1=cos-2+isin-2=cos2-isin2=0-i(1)-1=-i..........(25)

To get the value of M4(-1), substitute i =-iin Equation (7).

localid="1659067624148" M4(-1)=11111-i-1i1-11-11i-1-i鈥︹ (26)

The inverse FFT of P is calculated as shown below:

InverseFFT(P)=14PMn(-1)鈥︹ (27)

Substitute the value of M4(-1)from Equation (26), P from Equation (23) in Equation (27).

role="math" localid="1659067795192" InverseFFT(P)=1411111-i-1i1-11-11i-1-i4000=144444InverseFFT(P)=1111........(28)

Formula (28)'s polynomial reflection of all the above matrix seems to be 1+x+x2+x3.

As a result, this polynomial's composition is 1=x+x2+x3and its FFT is (4,0,0,0) .

02

Solution of part (b)

The first polynomial is 1+x+2x2 鈥︹ (29)

Compare equations (8) and (29)

a0= 1

a1= 1

a2= 2

a3= 0 鈥︹ (30)

Consider the formula of polynomial to matrix transformation.

A=a0a1a2a3鈥︹ (31)

,

Substitute the above values of a0,a1,a2,a3in Equation (31).

A=1120鈥︹ (32)

The FFT of A (1,1,2,0)is calculated as follows:

FFTofA=M4A............(33)

Substitute the values M4 from Equation (7) andA from Equation (32) in Equation (33).

FFTofA=11111i-1-i1-11-11-i-1i1120=1+1+2+01+i-2+01-1+2+01-i-2+0FFTofA=4i-12-i-1....(34)

The second polynomial is 2+3x鈥︹ (35)

Compare equations (8) and (35)

localid="1659069567337" a0=2a1=3a2=0a3=0鈥︹ (36)

Consider the formula of polynomial to matrix transformation.

B=a0a1a2a3鈥︹赌(37)

Substitute the above values of a0,a1,a2,a3in Equation (37).

B=2300 .........(38)

The FFT of B ( 2, 3, 0, 0 ) is calculated as follows:

FFTofB=M4B鈥︹ (39)

Substitute the values M4()from Equation (7) and B from Equation (38) in Equation (39).

localid="1659070329001" FFTofB=11111i-1-i1-11-11-i-1i2300=2+3+0+02+3i+0+02-3+0+02-3i+0+0FFTofB=52+3i-12-3i

The product of the polynomial is 1+x+x2and 2+3xis

Product=(1+x+2x2)(2+3x)=2+3x+2x+3x2+4x2+6x3=2+5x+7x2+6x3......(41)

,

Let the product of FFT of A and FFT of B be P. The product is calculated as shown below:

P=FFTofAFFTofB鈥︹ (42)

Substitute the values of FFT of 鈥淎鈥 from Equation (34) and FFT of 鈥淏鈥 from Equation (40) in Equation (42).

P=4i-12-i-152+3i-12-3i=202+3i2+-2-3i-2-2i-3i2-2-3i=20-2-i-3-2-2+i-3=20-5-i-2-5+i

The inverse FFT of P is calculated as shown below:

Inverse FFT(P) 14PMn(-1) 鈥︹ (44)

Substitute the value of M4(-1)from Equation (26), P from Equation (43) in Equation (44).

Inverse of FFT (P) role="math" localid="1659073083704" InverseFFT(P)=1411111-i-1i1-11-11i-1-i20-5-i-2-5+i=1420-5-i-2-5-i20-i(-5-i)-2-i(-5+i)20-(-5-i)-2-1(-5+i)20+i(-5-i)-(-2)-i(-5+i)=148202824InverseFFT(P)=2576.....(45)

The polynomial representation of the above matrix from Equation (45) is

2+5x+7x2+6x3.

Therefore, the product of the polynomial is 2+5x+7x2+6x3and its FFT is

(20,-5-i,-2,-5+i).

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Professor F. Lake tells his class that it is asymptotically faster to square an -bit integer than to multiply two n-bit integers. Should they believe him?

Question: Solve the following recurrence relations and give a bound for each of them.

(a)T(n)=2T(n/3)+1(b)T(n)=5T(n/4)+n(c)T(n)=7T(n/7)+n(d)T(n)=9T(n/3)+n2(e)T(n)=8T(n/2)+n3(f)T(n)=49T(n/25)+n(3/2)logn(g)T(n)=T(n-1)+2(h)T(n)=T(n-1)+nc,whereisaconstant(i)T(n)=T(n-1)+cn,whereissomeconstant(j)T(n)=2T(n-1)+1(k)T(n)=T(n)+1

Question: You are given an infinite array A[]in which the first n cells contain integers in sorted order and the rest of the cells are filled with . You are not given the value of n. Describe an algorithm that takes an integer x as input and finds a position in the array containing x, if such a position exists, in O(log n) time. (If you are disturbed by the fact that the array A has infinite length, assume instead that it is of length n, but that you don鈥檛 know this length, and that the implementation of the array data type in your programming language returns the error message whenever elements A[i]withi>n are accessed.)

Thesquare of a matrix A is its product with itself, AA.

(a) Show that five multiplications are sufficient to compute the square of a 2 x 2 matrix.

(b) What is wrong with the following algorithm for computing the square of an n x n matrix?

鈥淯se a divide-and-conquer approach as in Strassen鈥檚 algorithm, except that instead of getting 7 subproblems of size n2, we now get 5 subproblems of size n2 thanks to part (a). Using the same analysis as in Strassen鈥檚 algorithm, we can conclude that the algorithm runs in time O (nc) .鈥

(c) In fact, squaring matrices is no easier than matrix multiplication. In this part, you will show that if n x n matrices can be squared in time S(n) = O(nc), then any two n x n matrices can be multiplied in time O(nc) .

  1. Given two n x n matrices A and B, show that the matrix AB + BA can be computed in time 3S(n) + O(n2 ) .
  2. Given two n x n matrices X and Y, define the 2n x 2n matrices A and B,L as follows:
    A=X000andB=0Y00
    What is AB + BA, in terms of X and Y?
  3. Using (i) and (ii), argue that the product XY can be computed in time 3S(2n) + O(n2 ). Conclude that matrix multiplication takes time O(nc ).

Find the unique polynomial of degree 4 that takes on values p(1)=2,p(2)=1,p(3)=0,p(4)=4,andp(5)=0. Write your answer in the coefficient representation.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.