You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have investigated how frac, numer, denom flags are defined to work for polynomial expressions.
>>>fromsympyimport*>>>w, x, y, z=symbols('w x y z')
>>>a, b, c, d=symbols('a b c d')
>>>expr= (a+b)*(c+d)/(w+x)/(y+z)
>>>expr.expand(frac=False, numer=False, denom=False)
a*c/(w*y+w*z+x*y+x*z) +a*d/(w*y+w*z+x*y+x*z) +b*c/(w*y+w*z+x*y+x*z) +b*d/(w*y+w*z+x*y+x*z)
>>>expr.expand(frac=True, numer=False, denom=False)
(a*c+a*d+b*c+b*d)/(w*y+w*z+x*y+x*z)
>>>expr.expand(frac=False, numer=True, denom=False)
(a*c+a*d+b*c+b*d)/((w+x)*(y+z))
>>>expr.expand(frac=False, numer=False, denom=True)
(a+b)*(c+d)/(w*y+w*z+x*y+x*z)
But I also notice that things are not working consistently if the expression is not a single rational expression, but an addition of rational expressions.
Because 1,2,3 results are actually expanding the denominator even if denom=False, and fourth result is not expanding the denominator even if denom=True
And I wonder the above results are issue and should be handled like
I have investigated how
frac
,numer
,denom
flags are defined to work for polynomial expressions.But I also notice that things are not working consistently if the expression is not a single rational expression, but an addition of rational expressions.
Because 1,2,3 results are actually expanding the denominator even if
denom=False
, and fourth result is not expanding the denominator even ifdenom=True
And I wonder the above results are issue and should be handled like
The text was updated successfully, but these errors were encountered: