Home Login  |   Contact  |   About Us       Tuesday, May 17, 2022   

j0182084- Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE ›   Functions Smalltalk ›  ~ Error,Gammma,Beta



Skip Navigation Links.




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







Consulting Services - Back to Home
Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
KMP ARTICLES
Brand





Home

Login

Contact
Since 2006 All Rights Reserved  © KMP Software Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE