1 | initial version |
If you type
sage: f??
You will see that the method .__call__
(responsible for the behaviour of evaluating f
) is the one-liner
return vector([e(*args, **kwargs) for e in self])
This has been designed so that symbolic functions can safely be used in symbolic expressions in a meaningful way.
There is no way around it. If you really only need to return a list, then an ordinary python function (like (2) or (3)) is probably enough. Or you can convert the output of f
to a list like so:
sage: list(f(x))
2 | No.2 Revision |
If you type
sage: f??
You will see that the method .__call__
(responsible for the behaviour of evaluating f
) is the one-liner
return vector([e(*args, **kwargs) for e in self])
This has been designed so that symbolic functions can safely be used in symbolic expressions in a meaningful way.way. For example, you can combine f
with another symbolic function using the vector product operator *
:
sage: f(x) = [x,x]
sage: f
x |--> (x, x)
sage: f * f
x |--> 2*x^2
This would not work with ordinary python lists.
There is no way around it. If you really only need to return a list, then an ordinary python function (like (2) or (3)) is probably enough. Or you can convert the output of f
to a list like so:
sage: list(f(x))