Aitken Lagrange Cubic Construction

A few weeks ago Peter Bartholomew (uk.linkedin.com/in/peterbartholomew ) visited my blog. He made a very valuable suggestion – put up a demonstration for the construction of points on a cubic using the Aitken- Lagrange construction.

He sent me a sample workbook that demonstrated the point wise construction of a Bezier Cubic.

I have now re-engineered his workbook and have generated a user controlled demonstration for the Aitken-Lagrange construction of points on a cubic.

This workbook also demonstrates the technique of incorporating User Define Functions in Named Ranges. I believe that Bob Umlas (www.linkedin.com/pub/bob-umlas/46/278/479 ) was the first to discover this technique.

The User Defined Functions employed by this demonstration are:

Name Definition

X_Values =OFFSET(Aitken_Lagrange!$D1,0,0)

y_12_FLINE =(Y_P1*(X_P2-X_Values)+Y_P2*(X_Values-X_P1))/(X_P2-X_P1)

Y_23_FLINE =(Y_P2*(X_P3-X_Values)+Y_P3*(X_Values-X_P2))/(X_P3-X_P2)

Y_34_FLINE =(Y_P3*(X_P4-X_Values)+Y_P4*(X_Values-X_P3))/(X_P4-X_P3)

Y_123_FLINE =(y_12_FLINE*(X_P3-X_Values)+Y_23_FLINE*(X_Values-X_P1))/(X_P3-X_P1)

Y_234_FLINE =(Y_23_FLINE*(X_P4-X_Values)+Y_34_FLINE*(X_Values-X_P2))/(X_P4-X_P2)

Y_1234_FLINE =(Y_123_FLINE*(X_P4-X_Values)+Y_234_FLINE*(X_Values-X_P1))/(X_P4-X_P1)

Note well: The definition for the X_Values coming from Column D on Aitken_Lagrange Sheet enables the calculation of both the XStar lookup at the top of the sheet as well as the table of values at the bottom of the sheet.

The construction first evaluates Y_12_FLINE, Y_23_FLINE and Y_34_FLINE at XStar.

These results are the used to evaluate Y_123_FLINE and Y_234_FLINE at XStar.

And finally Y_1234_FLINE at XStar.

These steps can also be presented using the Functional Form for FLINE:

Function FLINE(ByRef XL As Double, _

ByRef YL As Double, _

ByRef XR As Double, _

ByRef YR As Double, _

ByRef XSTAR As Double) As Double

‘======================================

If Abs(XR – XL) > 0 Then

FLINE = (YL * (XR – XSTAR) + YR * (XSTAR – XL)) / (XR – XL)

Else

FLINE = 0.5 * (YL + YR)

End If

End Function

y_12_FLINE =FLINE(X_P1,Y_P1,X_P2,Y_P2,XStar)

Y_23_FLINE =FLINE(X_P2,Y_P2,X_P3,Y_P3,XStar)

Y_34_FLINE =FLINE(X_P3,Y_P3,X_P4,Y_P4,XStar)

Y_123_FLINE =FLINE(X_P1,Y_12_FLINE,X_P3,Y_23_FLINE,XStar)

Y_234_FLINE =FLINE(X_P2,Y_23_FLINE,X_P4,Y_34_FLINE,XStar)

Y_1234_FLINE =FLINE(X_P1,Y_123_FLINE,X_P4,Y_234_FLINE,XStar)