I’m having a problem writing the macro for the question statement below:
Write a function named SecondDerivative that returns the second derivative of the function at a specified x based on a central approximation. The function should take 2 arguements: the value of x where the derivative is to be evaluated and the value of DeltaX to be used for the central difference. Assume that the function is available in a VBA function termed myf(). myf() takes 1 arguement: the x value where the function is to be evaluated. For example, if the function is 3x^2+2x-1, then assume that the following code is already available:
Currently this is what I have:Option Explicit
Function myf(x as double) as double
myf = 3*x^2+2*x-1
End Function
Thanks for any help,Function SecondDerivative (x, Dx) As Double
Second Derivative = [myf(x+Dx)-myf(x-Dx)]/(2*Dx)
End Function
Brandon
Bookmarks