On 2016-12-02, D. S. McNeil <[email protected]> wrote: > You can arrive at your goal in lots of ways. You could sum the component > monomials, which is short but less general: > > sage: R.<x1,x2,x3> = QQbar[] > sage: P = x1^2 + 2*x1*x2 + x2^2 + 2*x1*x3 + 2*x2*x3 + x3^2 + 2*x1 + 2*x2 + > 2*x3 + 1 > sage: sum(P.monomials()) > x1^2 + x1*x2 + x2^2 + x1*x3 + x2*x3 + x3^2 + x1 + x2 + x3 + 1
Why not simply sage: copy(P) ? Of course, when working with composed Python types such as lists or dictionaries, you'd have a difference between copy() and deepcopy(). Very likely, copy(P) will be a lot faster than any hand-crafted solution such as sum(P.monomials()) Cheers, Simon -- 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.
