-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transforming expressions into polynomials #920
Comments
Thanks for your suggestions, that sounds like useful additions. If anyone is interested in implementing one of the proposed functions please drop a message here. |
@josdejong, by using It makes sense?
So the expression:
results in:
The root node is the operator divide ( To solve |
He, that looks good, basically just a different set of rules with simplify. That's neat. |
@josdejong, thanks. I've added 2 additional rules in order to handle with more complex polinomial expressions:
So
Results in
With few lines one can separate the numerator and denominator:
|
sounds good! Can you work this out in a pull request as a new function with tests and docs? |
Algebrite is an alternative javascript package for math.
In Algebrite there are a set of functions very useful to convert a expression in a polynomial equation, that can be solved by some numeric or algebric method, some specific to polynomial form, like the reputed Jenkins-Traub method.
expand - deletes all parentheses from an expression, except, of course, function parentheses.
Example:
rationalize, numerator, denominator - the first function rationalizes a expression converting in a numerator and denominator, both get without divide operators. Related functions are numerator that returns the upper part and denominator that returns the lower part of an expression.
The numerator function can be used to reduces an general expression to a direct polynomial equation form. So one can solve the resulting equation for any method.
However, mathjs is much sturdier than algebrite.
For instance,
s = "(2x-5)*(3x-3)*(x+4) / (x^2-5) + (x-5)*(2x-3)*(2x+5) / (x^2+3x-2) + 2x - 3";
It's enough to use numerator or any other function to let algebrite nuts. The same does not happens in mathjs.
It would be great if these functions (expand, rationalize, numerator, denominator) existed in mathjs
The text was updated successfully, but these errors were encountered: