solutions are put in notion, check out the link below
notion:
https://www.notion.so/hw4-Numerical-Analysis-5492682d8f3d4affa99f8c1de92365eb
Part A. (30%) A.1 Show the discrete orthogonality of cosines X N j=0 1 cj coskxj cosk ′xj = 0 if k 6= k ′ 1 2 ckN if k = k ′ where xj = πj/N, j = 0, 1, 2, ..., N and ck = 2 if k = 0, N 1 otherwise. (Hint: by substituting complex exponential representations for cosines.) A.2 The discrete cosine series is defined by fj = X N k=0 akcoskxj j = 0, 1, 2, ..., N, where xj = πj/N. Prove that the coefficients of the series are ak = 2 N 1 ck X N j=0 1 cj fj coskxj k = 0, 1, 2, ..., N.
Part B. (20%) Differentiate the following functions using two methods: FFT and central difference formula f ′ j = fj+1 − fj−1 2h . When you use the central difference formula, compute the derivative only at the interior points but not at the boundary points. For each method, use N = 16 and N = 32. Plot your results based on FFT and central difference formula as symbols (for example, squares or triangles) and the exact derivative as a continuous line. B.1 f(x) = sin3x + 3cos6x 0 ≤ x < 2π 1 B.2 f(x) = 6x − x 2 0 ≤ x < 2π Which method works better in B.1? Which method works better in B.2? Can you explain the reason?
Part C. (30%) Here are two functions f(x) and g(x) defined in the interval (0, 2π), i.e. f(x) = sin(2x) + 0.1sin(15x), g(x) = sin(2x) + 0.1cos(15x). C.1 Use N = 32 grid points, i.e. xj = 2πj/N, j = 0, 1, 2, ..., N − 1. Compute fj = f(xj ), gj = g(xj ) and Hj = fjgj . Compute the FFT of Hj , i.e. Hˆ k, k = −N/2, −N/2 + 1, ..., −1, 0, 1, ..., N/2 − 1? What is the real function that Hˆ k represents? C.2 Use N = 32 grid points and compute the FFT of fj , i.e. ˆfk, and the FFT of gj , i.e. ˆgk. Compute hˆm using the convolution sum hˆ k = N/ X 2−1 m=−N/2 ˆfmgˆk−m, where k = −N/2, −N/2 + 1, ..., −1, 0, 1, ..., N/2 − 1. What is the real function that hˆ k represents? C.3 Use trigonometric identities to show the exact result of E(x) = f(x)g(x). Use N = 32 grid points and compute Ej = E(xj ) and the FFT of Ej , i.e. Eˆ k. Does Eˆ k represent E(x) correctly? Do you see any difference among Eˆ k, Hˆ k and hˆ k? Which is correct? Why?
Part D. (20%) We use the Chebyshev derivative matrix operator to differentiate u(x) = 4(x 2 − x 4 )e −x/2 in the range −1 ≤ x ≤ 1. Let vector x represent the collocation points xj = cos(πj/N), j = 0, 1, 2, ..., N, and vector u represent the values of u(x) at the collocation points. Construct the (N + 1) × (N + 1) Chebyshev collocation derivative matrix D using (6.46) or (6.47) in the textbook. D.1 For N = 7, write down the vectors x and u, the derivative matrix D, and the first derivative of u(x) at the collocation points, i.e. u ′ , via u ′ = Du. Plot the first derivative u ′ at the collocation points using symbols and the exact first derivative using a continuous line. D.2 For N = 7, write down the vectors x and u, the second derivative matrix D2, and the second derivative of u(x) at the collocation points, i.e. u ′′, via u ′′ = D2u. Plot the second derivative u ′′ at the collocation points using symbols and the exact second derivative using a continuous line.