Expression simplification in SymPy

后端 未结 1 908
慢半拍i
慢半拍i 2021-01-18 11:04

I want to achieve this kind of simplification: e+ac+ad+bc+bd = e+(a+b)(c+d) . None of SymPy simplification functions worked this way. Is there any other method

相关标签:
1条回答
  • 2021-01-18 11:51

    You can use collect(expr, e, func=factor).

    In [5]: expr = e + a*c + a*d + b*c + b*d
    
    In [6]: collect(expr, e, func=factor)
    Out[6]: e + (a + b)⋅(c + d)
    
    0 讨论(0)
提交回复
热议问题