Site Statistics  |   Contact  |   About Us Tuesday, December 11, 2018
HOME › AREAS OF EXPERTISE › Function Evaluation in Smalltalk › ~ Polynomials,Error,Gammma,Beta

POLYNOMIALS
Polynomials - General Implementation

Polynomials are quite important because they are often used in approximating functions, which are determined by experimental measurements in the absence on any theory on the nature of the function.

A polynomial is a special mathematical function whose value is computed as follows:

 P(x) = ∑nk akxk

In this equation, n is called the degree of the polynomial. A second-order polynomial:

 x2 - 3x + 2

has degree 2. It represents a parabola crossing the x-axis at points 1 and 2 and having a minimum at x = 2/3. This second-order polynomial, is represented by the array {2, -3, 1}.

In the equations above, the numbers a0,...,sn are called the coefficients of the polynomial. Thus, a polynomial can be represented by the array {a0,...,an}. For example, the second-order polynomial described above, is represented by the array {2, -3, 1}.

The best approach to evaluate a polynomial consists of factoring out x before the evaluation of each term, such as:

 (x) = a0 + x {a1 + x[a2 + x(a3]}

Evaluating this expression requires only multiplications, instead of raising the variable to an integral power at each term as shown in the sum before. The resulting algorithm is quite straightforward to implement.

on polynomial derivatives...

The derivative of a polynomial with n coefficients is another polynomial, with n - 1 coefficients derived from the coefficients of the original polynomial, as follows:

 a'k = (k + 1)ak + 1      for k = 0,...,n-1.

on polynomial integrals...

The integral of a polynomial with n coefficients is another polynomial, with n + 1 coefficients derived from the coefficients of the original polynomial, as follows:

 a- = ak-1 / k     for k = 1,...,n+1.

Adding or subtracting two polynomials yields a polynomial whose degree is the maximum of the degrees of the two polynomials. Multiplying two polynomials yields a polynomial whose degree is the product of the degrees of the two polynomials.

IMPLEMENTATION

 Being a special case of a function a class KmpPolynomial was created to hold related methods for execution. The code first creates an instance of the class by giving the coefficients of the polynomial. Code for derivative, integral and multiplication are included as examples of polynomial computation.

 Script for Polynomial Evaluation The following code provides the set up to execute the polynomial. It is presented as a window class in Smalltalk (shown below) and executed on a Smalltalk workspace window. The RESULTS follow and are shown on a Smalltalk transcript window.

RESULTS

 You are viewing this tab ↓

Math, Analysis & More,
established expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method

INTERPOLATION APPLICATIONS...
Cubic Spline Method
Newton Divided Difference

 Applied Mathematical Algorithms
 Complex Functions A complex number z = x + iy, where... Complex Functions Non-Linear Systems Non-linear system methods... Non Linear Systems Differentiation Construction of differentiation... Differentiation Integration Consider the function where... Integration