Question: Write a function mySecondDerivativeOrder4 that calculates the second derivative d^2y/dx^2 of a data set (x, y) with fourth order accuracy at each data point. The
Write a function mySecondDerivativeOrder4 that calculates the second derivative d^2y/dx^2 of a data set (x, y) with fourth order accuracy at each data point. The data is equidistant in x with spacing h. The function input shall be y: one-dimensional column vector of y values h: scalar value of spacing h The function output shall be d^2y: column vector of the same size as y containing d^2y/dx^2 Calculate d2y/dx2 using only the following formulas that use the nomenclature of Table 8-1 and the lecture notes: f''(xi) = (10f(xi5) + 61f(xi4) 156f(xi3) + 214f(xi2) 154f(xi1) + 45f(xi)/12h^2)+ O(h^4) (1) f''(xi) = (f(xi4) 6f(xi3) + 14f(xi2) 4f(xi1) 15f(xi) + 10f(xi+1)/12h^2)+ O(h^4) (2) f''(xi) = (f(xi2) + 16f(xi1) 30f(xi) + 16f(xi+1) f(xi+2)/12h^2)+ O(h^4) (3) f''(xi) = (10f(xi1) 15f(xi) 4f(xi+1) + 14f(xi+2) 6f(xi+3) + f(xi+4)/12h^2)+ O(h^4) (4) f''(xi) = (45f(xi) 154f(xi+1) + 214f(xi+2) 156f(xi+3) + 61f(xi+4) 10f(xi+5)/12h^2)+ O(h^4) (5) For every data point, use the most accurate formula, noting that Eq. (3) is the most accurate, followed by Eqs. (2) and (4), and followed by Eqs. (1) and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
