-
Notifications
You must be signed in to change notification settings - Fork 59
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
simplify differences between 1.2 and 1.3 #131
Comments
Do you happen to have more information about this @ribrdb ? Maybe the exact commit that made things worse? Or minimal example that shows the problem? Or something like a test set with a range of small examples that I could use? I'd be happy to address this, but there are other bugs that take priority. If you have the time to collect more information then I'd be happy to take a look earlier though. |
note to self: might be related to #109 (comment) ? |
It appears to be caused by the gcd part of 358e699 |
Here's some reduced versions of those two cases: 1/a - 1/factor(a): |
Thanks for finding the commit, that helps a lot. I think the gcd changes were good. For example pre-358e699 we have In fact I think that the problem boils down to "rationalize" not doing its job properly: pre-358e699 we have It looks to me that Will look into this more. P.S. gcd itself is better than before, but it factors polynomials to get the job done, which is extreme overkill, and limits the degree (because we factor via symbolic roots which works up to a point and is expensive). Should be using Euclid's algorithm instead. |
log showing how the "correct" gcd confuses "rationalise": Leaving the "correct" gcd:
i.e. in Sabotaging gcd to just return
...in this case the system finds an inefficient denominator which contains both monomials (due to bad gcd), one with each sign, so each term's denominator finds a matching one, and hence triggers the num/denom simplification. ...So it would seem that just by improving the |
Hi @davidedc, I'm hitting similar issues with simplification. Will you get a chance to look at it? Nerdamer also has simplification issues, it seems if we want simplification there is no library out there. Screenshots attached of before and after simplification |
@28raining , |
Hey Yaffle, awesome, your lib works! Would be super helpful if you can support variable name like R1 - I just created an issue on your git. var matrix = ExpressionParser.parse('-1/(ab(-1/(ab)-1/(ac)-1/(bc)))-1/(ac(-1/(ab)-1/(ac)-1/(bc)))'); *inverse matrix is part of MNA, which I'm building a web tool around https://lpsa.swarthmore.edu/Systems/Electrical/mna/MNA2.html |
For some rational polynomial expressions, I'm seeing worse simplification results with version 1.3.1 than with 1.2. Additionally, the results take much longer to compute:
with 1.2.0
with 1.3.1
I'm also seeing many expressions that used to run quickly evaluating much slower. It seems possible this is from the rational simplification. Maybe that should be a separate function? Or have a way to turn it off for quicker results.
The text was updated successfully, but these errors were encountered: