-
Notifications
You must be signed in to change notification settings - Fork 148
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
Zero terms in simplification #34
Comments
This is what I get with the latest git version (where factorization/simplification has been improved):
I assume that you get a different result. |
Yes, but I have the latest git too 😄 It appears to depend on assumptions setting. Is that expected? |
I assume you get x^2 + 0x - 1 when simplifying (x - 1)(x + 1) because there are no assumptions for the type of x. I do not remember the original reasoning for this behaviour, but there are some values for x where 0*x does not equal zero (e.g. if x is a matrix). (The problem is that for matrices x^2 - 1 does not equal (x - 1)(x + 1).) |
But matrix^2+0×matrix=matrix^2, so the current behaviour should not be necessary for matrices. I do not understand why (matrix - 1)(matrix + 1) currently gives such a strange result (it might be a bug). Edit: matrix^2+0*matrix only equals matrix^2 if numbers of rows and columns are equal. |
Current behavior formally breaks invariant, so factor ≠ simplify. Though, this is just an optimization issue, because it adds a zero term, so nothing really serious. As for matrices, I don't understand what is the meaning of matrix minus scalar? I admit that I never used matrices in Qalculate! |
I never use matrices myself. There is no meaning of matrix minus scalar (at least not in Qalculate! where matrix - scalar = matrix - scalar). If you know that x does not represent a matrix you should at least set assumptions to not matrix (default assumption is real number), to avoid unexpected oddness. The ability to combine all types (units, numbers, matrices, etc.) in one expression, even if it might be meaningless, has it quirks. |
Yes, polynomials over matrices are very odd at least. Especially with scalars and non-square matrices as its terms. But the point is that the zero term in polynomials seems to be meaningless in case of matrices anyway. So, I believe that there is no reason to make it a special case. Otherwise it appears all of a sudden without any particular reason. |
The best option might be to simply remove the possibility that x is a matrix and make number the first option for assumption type. There are more cases where x as matrix is broken and at the moment it has no real use. |
… and electric constants, and introduce completion only only names to enable completion of greek letters from the roman letter names (qalculate-gtk issue #34)
This is more a CAS issue but still.
Try e.g.
The text was updated successfully, but these errors were encountered: