Reference no: EM13863159
Question 1
A forward difference approximation to the first derivative of a function f(x) at xi is given by the formula
(df/dx)= [a1f(xi) + a2f(xi + Δx) + a3f(xi + 2Δx) + a4f(xi + 3Δx) + a5f(xi + 4Δx] / 12Δx
where Δx is the mesh spacing.
(a) Determine coefficients a1, a2, a3, a4, and a5 so that the finite difference approximation is 4th order accurate. You can use Taylor's series expansions, the method of undetermined coefficients or Lagrange polynomial approximation for your derivation, however you should show each step clearly in your calculations.
(b) Use the approximation derived in part (a) to determine the first derivative of the function
f(x) = x3Sin(2x) - 2x
at xi = -3.0 for Δx = 0.1, 0.01, and 0.001. Also calculate the error for each Δx value by using the exact derivative of the function at the given point.
Comment on the results you have obtained.
Question 2
Approximate the function given in part (b) of question 1 using a
(a) natural cubic spline with 13 equally spaced data points on the interval -3.0 ≤ x ≤ 3.0.
(b) clamped cubic spline with 13 equally spaced data points on the interval -3.0 ≤ x ≤ 3.0. For the boundary condition at x = -3.0 approximate the first derivative with the finite difference formula derived in question 1 with ?x = 0.5. For the boundary condition at x = 3.0, use the exact value of the derivative.
For each part (part (a) and part (b)): plot the function and the approximation to the function on the same figure. On another figure plot the
error distribution. Give the error values at x = -2.8, -1.4, 0.0, 1.4, and 2.8 for each case. Using the plots and the error values, comment on the performance of the approximations obtained in part (a) and part (b).
Question 3 Numerically evaluate the integral
x1=0∫x2=2 y1=0∫y2=3 (2x 5 +(x2/3) + x)(y3 -(y/4)+ 1)dydx
by using Gaussian quadrature in both directions. For the quadrature in each direction, use the formula with the minimum number of points, which will give you the exact value of the integral in the absence of round-off errors. You can do this problem by hand, with the computer routine you have developed, or using both. However, you should give a full description about your solution and explain your reasoning in the selection of the quadrature formula.
Question 4
dy/dt = (y2 + y)/t, 1.0 ≤ t ≤ 3.0, y(1) = -2.0
Approximate the solution to the above initial value problem using
(a) 4-step Runge-Kutta Method
(b) 2-step Adams-Bashforth Method
(c) Euler Explicit Method
with a time step of h = 0.1. For the Adams-Bashforth Method, use starting values obtained from 4-stage Runge-Kutta method. For each method, tabulate the error at each time step using the exact solution to this problem:
y(t) = 2t/ (1 - 2t)
Show the approximate solutions and the exact function in the same graph. In another graph, plot the error distributions. Note that you may need to give a separate plot for the error of 4-stage Runge-Kutta scheme to see the trend in a larger scale. Comment on the performance of each method by specifying possible advantages and/or disadvantages.