close

solutions are in notion, check it out

notion:

https://www.notion.so/hw2-Numerical-Analysis-2d74573552b94388bfa0a3228dd3d924

 

image

image

image

image

image

 

Part A. (20%) We will consider three finite difference schemes for the first derivative, i.e. forward difference f ′ (xj ) = f(xj+1) − f(xj ) h , second-order central difference f ′ (xj ) = f(xj+1) − f(xj−1) 2h , fourth-order central difference f ′ (xj ) = f(xj−2) − 8f(xj−1) + 8f(xj+1) − f(xj+2) 12h . A.1 Please use Taylor series to show that these schemes are first-order O(h), second-order O(h 2 ) and fourthorder O(h 4 ), respectively. Here we use uniform grid points and h is the spacing between two consecutive grid points, i.e. h = xj+1 − xj . A.2 Now we take the function to be f(x) = sinx x 3 , so that the exact first derivative is known. Please use the above three finite difference schemes to numerically evaluate f ′ (xj ) at xj = 4 and compute the absolute values of error. You may choose h = 1, h = 0.5, h = 0.1, h = 0.05, h = 0.01, h = 0.005 and plot the absolute values of error versus grid spacing on a log-log plot.

Part B. (20%) The fourth-order Pad´e scheme for the first derivative is f ′ (xj−1) + 4f ′ (xj ) + f ′ (xj+1) = 3 h (f(xj+1) − f(xj−1)). B.1 Please use Taylor series to show this Pad´e scheme is fourth-order O(h 4 ). B.2 Please derive the modified wavenumber k ′ for the second-order central difference (given in Part A), fourth-order central difference (given in Part A) and fourth-order Pad´e scheme for the first derivative. Plot k ′h versus kh for the three modified wavenumbers for 0 ≤ kh ≤ π, where h is the grid spacing. In this plot, please also include k ′h = kh, which is the exact wavenumber. (Note that k = 2πn/L, n = 0, 1, 2, ..., N/2 where L is 1 the period and h = L/N is the grid spacing. The grid points are xj = hj, j = 0, 1, 2, ..., N − 1. )

Part C. (20%) We will use the fourth-order Pad´e scheme (given in Part B) to numerically evaluate the first derivative of a known function f(x) = sin(5x) for 0 ≤ x ≤ 3. Fifteen uniformly spaced points are used here. Please note that x0 = 0 and xN = 3 while N = 14. For the left boundary (x0 = 0) and right boundary (xN = 3), use the following schemes f ′ 0 + 2f ′ 1 = 1 h (− 5 2 f0 + 2f1 + 1 2 f2), and f ′ N + 2f ′ N−1 = 1 h ( 5 2 fN − 2fN−1 − 1 2 fN−2). C.1 Please use Taylor series to show the above two boundary schemes are third-order O(h 3 ). C.2 Using the fourth-order Pad´e scheme with the boundary schemes, you may derive fifteen equations for the first derivative at fifteen grid points. What are your solutions of f ′ (xj ) for j = 0, 1, 2, ..., 14? Plot your solutions at the fifteen grid points with big dots and also plot the exact first derivative f ′ (x) = 5cos5x as a continuous line for 0 ≤ x ≤ 3.

Part D. (20%) For a periodic function f(x) = e ikx , its second derivative is −k 2f. A finite difference scheme for second derivative of f(x) would lead to −k ′2 f, where k ′2 is the ‘modified wavenumber’ for the second-derivative. D.1 Derive the ‘modified wavenumber’ for the central difference formula f ′′(xj ) = f(xj+1) − 2f(xj ) + f(xj−1) h 2 . D.2 Use Taylor series to show that the following Pad´e scheme 1 12 f ′′(xj−1) + 10 12 f ′′(xj ) + 1 12 f ′′(xj+1) = f(xj+1) − 2f(xj ) + f(xj−1) h 2 is fourth-order accurate. D.3 Derive the ‘modified wavenumber’ for the Pad´e scheme given in D.2. 2 D.4 Plot the ‘modified wavenumber’ in D.1 and D.3 in terms of k ′2 h 2 versus kh for 0 ≤ kh ≤ π. In this plot, please also include k ′2 h 2 = k 2h 2 , which is the exact ‘wavenumber’.

Part E. (20%) Consider the central finite difference scheme δun δx = un+1 − un−1 2h . In calculus we have duv dx = u dv dx + v du dx. E.1 Does the following finite difference expression hold? δ(unvn) δx = un δvn δx + vn δun δx E.2 Please show that δ(unvn) δx = ¯un δvn δx + ¯vn δun δx , where u¯n = 1 2 (un+1 + un−1) and ¯vn = 1 2 (vn+1 + vn−1).

 

arrow
arrow
    創作者介紹

    Josephood7 發表在 痞客邦 留言(0) 人氣()