1) Because of the way expressions are parsed in sympy before displaying I am not aware of a way of doing this. You can experiment with sympy.ratsimp(), but my tests show that you will get the same expanded expression output in the end.
2) You probably do not want to use sympy.Eq to represent an equation. sympy.Eq is a logical statement that when evaluated collapses to True, False or if that can't be determined maintains the expression. It does not support performing algebraic manipulations on the expression. Without more information about what you are trying to do I cannot be sure, but suspect you are looking for the equation capabilities contained in the the project Algebra_with_Sympy (https://github.com/gutow/Algebra_with_Sympy). There has been discussion of including the capabilities of that project in Sympy, but a decision on how to move forward has not been made yet. In the interest of full disclosure I am the original author of the Algebra_with_Sympy package. Regards, Jonathan On Saturday, February 19, 2022 at 5:19:54 PM UTC-6 [email protected] wrote: > Hi, > > I'm using Sympy to generate latex for a webpage, but I have an issue when > converting algebraic fractions into latex. I have attached an image with an > example, I use sympy.Eq() to set up an equation and then convert it to > latex using sympy.latex(). Is there anyway to prevent sympy from splitting > these fractions up? > > Thanks! > -- 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 on the web visit https://groups.google.com/d/msgid/sympy/c4745042-4ed2-46a9-9802-2798d12c8d4dn%40googlegroups.com.
