Tuesday, February 7, 2017

Computing Cubic Curves Using Finite Differences

  The following tables compares the computation of a portion of a cubic curve by two different methods, the first using a cubic equation, y, and the second using finite differences, y'. The results are indistinguishable.

The first three columns are generated by setting up the first row and then chaining the calculations of the remaining rows to it using the selection and drag procedure.

To create an initial table of finite differences one calculates the first four values of y' using the cubic equation and calculates the differences shown in blue. For a cubic curve the third differences are all the same so one can use drag and fill replicate the entries in the last column. The differences to the left are found doing simple sums since each entry is equal to the previous entry plus its difference.

Once we have the difference table the values of y' are calculated by the sum of a previous value plus three differences.

The finite difference method is preferable from a calculation point of view since it doesn't involve multiplications which are more time consuming but only simple sums are required. The accuracy of the result does not depend on the size of the step.

No comments: