SymPy was assuming that all variables behave like regular numbers (where 2 x3 is the same as 3x2).
However, in advanced math (like *Matrices* or *Quantum Physics*), the order matters (AxB is *not* the same as BxA). This is called *Non-Commutative* math. SymPy was incorrectly using high-school formulas like: sin(A+B) = sin(A)cos(B) + sin(B)cos(A) This formula is *wrong* for Matrices. It should have stayed as just sin(A+B) . ------------------------------ *The Solution: The "Wait, Stop!" Rule* I added a "Guard Clause" (a safety check) to the code for sin, cos, and tan. *The logic I added is simple:* Before expanding a formula, the computer now asks: *"Are these variables non-commutative?"* * *If Yes:* It stops and leaves the expression alone (Fixed!). - *If No:* It expands it like normal (Standard math still works). -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/sympy/d7b9facd-9951-4a23-a72b-141fe9b70a81n%40googlegroups.com.
