1 | initial version |
You can split the components of f
, which is iterable:
sage: list(f)
[(7*t + 3, e1*e2), (2*t + 4, e2^2), (2*t + 7, e1), (6*t + 3, 1)]
Given an element of K
, you can get its components with respect to 1
and t
:
sage: z = 7*t + 3
sage: z.polynomial()
7*t + 3
sage: list(z.polynomial())
[3, 7]
With both ingredients, you can recombine f
the way you want. For example:
sage: g = sum(coeff.polynomial()[0]*variable for coeff,variable in f)
sage: h = sum(coeff.polynomial()[1]*variable for coeff,variable in f)
sage: g + t*h
(-4*t + 3)*e1*e2 + (2*t + 4)*e2^2 + (2*t - 4)*e1 + (-5*t + 3)
sage: g + t*h == f
True