[sage-devel] Re: Result of coefficients depends on names
On Thursday, January 18, 2018 at 9:17:01 PM UTC+1, Samuel Lelievre wrote: > Should there be a note about that in the documentation of the `poly` > method for symbolic expressions? I'd rather change the name to say rewrite_as_polynomial_in(x). I think it's clear enough that an expression does not carry info on generators if it happens to be in polynomial form. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Result of coefficients depends on names
Mon 2018-01-15 07:00:03 UTC, Ralf Stephan: > > expr.poly(x) does not really make expr a polynomial in x, it's a quite useless method. > If you give no parameter to ex.coefficients() it takes the lexicographically first variable. > So instead of ex.poly(x).coefficients do ex.coefficients(x), and you get: > > sage: (zeta*diff(f(tau), tau)).coefficients(tau) > [[zeta*diff(f(tau), tau), 0]] > sage: (zeta*diff(f(tau), tau)).coefficients(zeta) > [[diff(f(tau), tau), 1]] > sage: (a*diff(f(b), b)).coefficients(a) > [[diff(f(b), b), 1]] > sage: (a*diff(f(b), b)).coefficients(b) > [[a*diff(f(b), b), 0]] Should there be a note about that in the documentation of the `poly` method for symbolic expressions? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Result of coefficients depends on names
expr.poly(x) does not really make expr a polynomial in x, it's a quite useless method. If you give no parameter to ex.coefficients() it takes the lexicographically first variable. So instead of ex.poly(x).coefficients do ex.coefficients(x), and you get: sage: (zeta*diff(f(tau), tau)).coefficients(tau) [[zeta*diff(f(tau), tau), 0]] sage: (zeta*diff(f(tau), tau)).coefficients(zeta) [[diff(f(tau), tau), 1]] sage: (a*diff(f(b), b)).coefficients(a) [[diff(f(b), b), 1]] sage: (a*diff(f(b), b)).coefficients(b) [[a*diff(f(b), b), 0]] Regards, -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.