On Monday, December 12, 2016 at 10:55:32 AM UTC+1, Daniel Krenn wrote: > > (I can only think of very complicated and long workarounds, so what is > the best way to do this?) >
As you can see from sage: a = ((z^3 - 10*z^2 + 17*z - 8)/(z^4 + z^3 + z^2 + z + 1)).integrate(z) sage: a.operator() integrate sage: type(_) <class 'sage.symbolic.integration.integral.IndefiniteIntegral'> sage: a.operands() [(z^3 - 10*z^2 + 17*z - 8)/(z^4 + z^3 + z^2 + z + 1), z] and the source in src/sage/symbolic/integration/integral.py you must walk the expression tree and apply subs to the first operand of all instances of integrate which is a symbolic function (operator). To do such walks in Python you usually create a subclass of one of the classes in symbolic/expression_conversions.py An example can be seen at https://github.com/sagemath/sage/blob/master/src/sage/symbolic/expression.pyx#L5467 where sums with all-numeric arguments inside an expression are expanded. The rest of the expression is just copied. Note the class is defined inside the function where it's used. Regards, -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
