How to make a list of polynomials callable?
A polynomial is callable:
sage: R=PolynomialRing(QQ,5,"x")
sage: R.gens()
(x0, x1, x2, x3, x4)
sage: f=x0*x1-x3
sage: f
x0*x1 - x3
sage: f(1,1,1)
0
but a list of polynomial is not:
sage: L=[x0*x1, x2, x3*x4]
sage: L(1,1,1,1,1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-7ed7fddd166b> in <module>
----> 1 L(Integer(1),Integer(1),Integer(1),Integer(1),Integer(1))
TypeError: 'list' object is not callable
Question: How to make a list of polynomials callable?
I would like a function MakeCallable
as follows:
sage: def MakeCallable(L):
....: ....
....: return fL
where fL
would be as follows (here L=[x0*x1, x2, x3*x4]
):
sage: def fL(x0, x1, x2, x3, x4):
....: return [x0*x1, x2, x3*x4]