Client Account:   Login
Home Site Statistics   Contact   About Us   Sunday, March 26, 2017

users on-line: 2 | Forum entries: 6   
Pj0182295- Back to Home
   Skip Navigation LinksHOME › AREAS OF EXPERTISE › Function Evaluation in Smalltalk › ~ Polynomials,Error,Gammma,Beta


      Skip Navigation Links
   POLYNOMIALS   
   ERROR FUNCTION   
   GAMMA FUNCTION   
   BETA FUNCTION   
 

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




Skip Navigation Links.

Home Skip Navigation Links
   Algorithms, Graphics, Vectors,
            implementation techniques.
   Mineral Transactions info,
            sales, agreements...
   Numerical Modeling services
            mineral environment.
   Want to know about Mining?
            basic knowledge here...
   What are Mineral Commodities?
            our elementary charts.
   Math, Analysis and More...
            our expertise in the matter.

 

Platform Implementation

Home Algorithm Implementation
We design applications for different environments and platforms...
        Home Graphics and Animation
The graphics classes in Smalltalk were designed...
        Home Optimization Algorithms
An optimization problem is a numerical problem...
        Home Vectors and Matrices
The concise notation introduced in linear algebra for vector...
 



2017 © Keystone Mining Post  |   2461 E. Orangethorpe Av., Fullerton, CA 92631 USA  |   info@keystoneminingpost.com