Tuesday 28 October 2008

Notation, notation, notation

Upon re-reading my last post, it occurred to me that the notation chosen was likely to be confusing.

To illustrate, we will take the 4 equations previously stated, and line up all of the terms:
Constanty = a
Lineary = ax + b
Quadraticy = ax2 + bx + c
Cubicy = ax3 + bx2 + cx + d
It will be noted that the name of equivalent coefficients changes in each equation.

If we were to use a generic form for the equation, then this name changing goes away:
y = anxn + an-1xn-1 + ... + a3x3 + a2x2 + a1x + a0
Whilst this looks more complex, if we just concentrate on equations of the cubic order and lower, we get:
y = a3x3 + a2x2 + a1x + a0
If a3 is 0, then we get a quadratic equation, and so on:
y = a2x2 + a1x + a0
I think this is potentially less confusing than having the coefficient names change with each order of equation. It also provides for a cleaner and clearer mapping between the underlying mathematics and Java arrays, if we were to chose that mechanism to store the coefficients.

No comments: