Algorithm To Find Derivatives Using Newtons Backward Difference Formula
In this article, you will learn step by step procedure (algorithm) to find derivatives using Newton's backward interpolation formula.
Following steps are required inorder to find derivatives using backward difference formula:
1. Start 2. Read number of data (n) 3. Read data points for x and y: For i = 0 to n-1 Read Xi and Yi,0 Next i 4. Read calculation point where derivative is required (xp) 5. Set variable flag to 0 6. Check whether given point is valid data point or not. If it is valid point then get its position at variable index For i = 0 to n-1 If |xp - Xi| < 0.0001 index = i flag = 1 break from loop End If Next i 7. If given calculation point (xp) is not in x-data then terminate the process. If flag = 0 Print "Invalid Calculation Point" Exit End If 8. Generate backward difference table For i = 1 to n-1 For j = n-1 to i (Step -1) Yj,i = Yj,i-1 - Yj-1,i-1 Next j Next i 9. Calculate finite difference: h = X1 - X0 10. Set sum = 0 11. Calculate sum of different terms in formula to find derivatives using Newton's backward difference formula: For i = 1 to index term = (Yindex, i)i / i sum = sum + term Next i 12. Divide sum by finite difference (h) to get result first_derivative = sum/h 13. Display value of first_derivative 14. Stop