1

I am seeking for a method to extract the high level summands of an expression, preferably in a kind of list. What I mean is the following:

Consider the following expression:

a+ b*log(c+1)+d*e**(f+g)

What I mean by high level summands, are the summands like this: (a, b*log(c+1), d*e**(f+g))

I do not want to get the summands of the logarithm (c+1) or (f+g) for example.

I saw that there is a description of the "advanced expression manipulation", but do not know how to solve my speficic problem. Perhaps there is an already implemented function like summands(expr), which I could not find yet?

Best regards, Johannes.

asmeurer
  • 86,894
  • 26
  • 169
  • 240
Johannes
  • 161
  • 1
  • 6
  • 2
    `expr.args` returns the top-level arguments of a sympy expression `expr`. See the [advaced expression manipulation](http://docs.sympy.org/latest/tutorial/manipulation.html#args) for details – Stelios Sep 02 '16 at 18:48
  • Thanks, that solved my problem. – Johannes Sep 02 '16 at 18:54
  • Possible duplicate of [How to find all terms in an expression in Sympy](http://stackoverflow.com/questions/37566132/how-to-find-all-terms-in-an-expression-in-sympy) – asmeurer Sep 06 '16 at 19:24

0 Answers0