Consider this use case

In [97]: expr = 1/(1-x) + 1/(1+x)

In [98]: e2 = Integral(expr, x)

In [99]: e2
Out[99]: 
⌠                    
⎮ ⎛  1       1   ⎞   
⎮ ⎜───── + ──────⎟ dx
⎮ ⎝x + 1   -x + 1⎠   
⌡                    


Suppose now I want to act on the expression inside the integral by applying 
*together* and *expand* on it, is there a simple way to do so?

In [102]: expr.together().expand()
Out[102]: 
   2    
────────
   2    
- x  + 1


More accurately, is there an easy way to select a subexpression, apply some 
transformations only on that subexpression, and returning the entire 
expression with the applied transformations?

In this case one could extract the integral argument by *e2.args[0]*, and 
then rebuild *e2.func(new_arg_0, e2.args[1:])*, but imagine if the tree 
expression is much more complicated and it is hard/uncomfortable to select 
the subexpression by accessing the *args*, what can one do?

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/b59b0e08-884b-4d09-9065-d604f3509d5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to