Jump to content

Polynomials functions


Mat
 Share

Recommended Posts

I have a plan for a large extension to my quadratic solver... And heres the work so far!

In mathematics, a polynomial is an expression of finite length constructed from variables (also known as indeterminates) and constants, using only the operations of addition, subtraction, multiplication, and non-negative, whole-number exponents. For example, x2 − 4x + 7 is a polynomial, but x2 − 4/x + 7x3/2 is not, because its second term involves division by the variable x and because its third term contains an exponent that is not a whole number.

Polynomials appear in a wide variety of areas of mathematics and science. For example, they are used to form polynomial equations, which encode a wide range of problems, from elementary word problems to complicated problems in the sciences; they are used to define polynomial functions, which appear in settings ranging from basic chemistry and physics to economics and social science; they are used in calculus and numerical analysis to approximate other functions. In advanced mathematics, polynomials are used to construct polynomial rings, a central concept in abstract algebra and algebraic geometry.

Current functions:

;_Polynomial_Add

;_Polynomial_Check

;_Polynomial_Div

;_Polynomial_Factorise

;_Polynomial_Format

;_Polynomial_GetMaxIndex

;_Polynomial_GetValues

;_Polynomial_IsRoot

;_Polynomial_Mul

;_Polynomial_Sort

;_Polynomial_Sub

;_Polynomial_ToHtml

;_Polynomial_ToRtf

Download link: Polynomial.zip

(NB: Not all have examples atm)

Mat

Edited by Mat
Link to comment
Share on other sites

It is an excellent start. However, I found a minor problem. I know it has not been coded yet but I thought I would point it out.

3x^(5+1x)+3 returns ""

This is still a great script and I look forward to updates. :D

Interesting idea, it would somewhat cripple the way the script works with arrays though...

must be in the form ax^2+bx+c, ax^3+bx^2+cx+d etc. depending on the order of the polynomial. I could try and get the regexp pattern to match brackets if they are used... but that will be quite difficult as i'm now looking at functions for expanding a factorised equation etc, and so depend on bracket detection.

I have already written several more functions for this so no doubt it will be updated soon.

Mat

Link to comment
Share on other sites

Updated!!!

Lots of functions added:

* _Polynomial_Add

* _Polynomial_Div

* _Polynomial_Factorise

* _Polynomial_IsRoot

* _Polynomial_Mul

* _Polynomial_Sub

Factorise being the most important of these, and also the one that ended up the best. Before (in the quadratic solver) I was comparing all the factors of a and b to test, When in fact you only need to test the factors of C. The div function also worked out pretty well, and I managed to get it working first guessing at what to do...

Mat

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...