Full description of the file
Source and code of polynomial math parser in VB.NET
This code contains five classes to evaluate a string of a real, complex, or polynomial mathematical expression, perhaps reducing the expression to a real or complex number or an equivalent polynomial. A mathematical expression may or may not contain variables.
Sample runtime images
In many situations, string may contain a mathematical expression, such as "1+2*5", "(3+i)(3-i)", or "(z^2*w+4z^3w-w^ 2-4z*w^2)/(w+4z*w)" and there is a need to calculate and calculate the result. Maybe we need to calculate the result for the values of different variables and the result can be another polynomial. In these cases, the polynomial parser provided here may help.
The classes here are a small - but improved - part of my free, downloadable CAS calculator. One of the goals is that these classes do not rely on other "external" classes, as is the case with the CAS calculator.
- The "Msg10" class contains only a few messages to handle possible errors.
- The "G10" class holds global members such as Regex patterns.
- کلاس " Rational" دقت بیشتری در عملیات می دهد.
- The "Complex" class performs complex math.
- The "Polynomial" class handles polynomials.
- The "Roots" class finds the roots and factors of polynomials.
The "parsePolynomial" class is responsible for dividing the input string into symbols and calling Roots or Polynomial class Msg10s based on it. Roots depends on Polynomial class which in turn depends on Complex and Complex on Rational. The "tokenization" work is done by a Regex pattern.