math::polynomials - Polynomial functions
This package deals with polynomial functions of one variable:
the basic arithmetic operations are extended to polynomials
computing the derivatives and primitives of these functions
evaluation through a general procedure or via specific procedures)
The package defines the following public procedures:
Return an (encoded) list that defines the polynomial. A polynomial
f(x) = a + b.x + c.x**2 + d.x**3
can be defined via:
set f [::math::polynomials::polynomial [list $a $b $c $d]
Coefficients of the polynomial (in ascending order)
Create a new procedure that evaluates the polynomial. The name of the polynomial is automatically generated. Useful if you need to evualuate the polynomial many times, as the procedure consists of a single [expr] command.
Coefficients of the polynomial (in ascending order) or the polynomial definition returned by the polynomial command.
Evaluate the polynomial at x.
The polynomial's definition (as returned by the polynomial command). order)
The coordinate at which to evaluate the polynomial
Return a new polynomial which is the sum of the two others.
The first polynomial operand
The second polynomial operand
Return a new polynomial which is the difference of the two others.
The first polynomial operand
The second polynomial operand
Return a new polynomial which is the product of the two others. If one of the arguments is a scalar value, the other polynomial is simply scaled.
The first polynomial operand or a scalar
The second polynomial operand or a scalar
Divide the first polynomial by the second polynomial and return the result. The remainder is dropped
The first polynomial operand
The second polynomial operand
Divide the first polynomial by the second polynomial and return the remainder.
The first polynomial operand
The second polynomial operand
Differentiate the polynomial and return the result.
The polynomial to be differentiated
Integrate the polynomial and return the result. The integration constant is set to zero.
The polynomial to be integrated
Return the degree of the polynomial.
The polynomial to be examined
Return the coefficient of the term of the index'th degree of the polynomial.
The polynomial to be examined
The degree of the term
Return the coefficients of the polynomial (in ascending order).
The polynomial in question
The implementation for evaluating the polynomials at some point uses Horn's rule, which guarantees numerical stability and a minimum of arithmetic operations. To recognise that a polynomial definition is indeed a correct definition, it consists of a list of two elements: the keyword "POLYNOMIAL" and the list of coefficients in descending order. The latter makes it easier to implement Horner's rule.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: polynomials of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
Mathematics
Copyright © 2004 Arjen Markus <[email protected]>