Ask Your Question

Revision history [back]

Sure, you can do something like this:

def poly_from_coeffs(coeffs, x):
    return sum(c*x^k for (k,c) in enumerate(reversed(coeffs)))

Example:

sage: poly_from_coeffs([2, 0, 2, 7], x)
2*x^3 + 2*x + 7