Hi Robert,
On 14 Mrz., 23:29, Robert Bradshaw <
rober...@math.washington.edu>
wrote:
> > Yes, but the fact that f(2,3) has a different parent than f(x=2,y=3)
> > has a high probability of being troublesome.
>
> Given f in R[x,y], I think f(x=a, y=b) should do exactly the same
> thing as f(a,b). The parent should be the same as R.base_ring()(0) + a
> + b.
+1. I think that f.__call__(*args,**kwds) of a polynomial f in
variables x,y,z should behave like a Python function of signature
f(x,y,z,**kwds). In particular, f(1,2,z=3, foo='bar') should do
exactly the same as f(1,2,3,foo='bar').
Note that currently the situation is not very consistent.
On the one hand, we already have the behaviour that you wish:
sage: R.<x,y> = ZZ[]
sage: P.<a,b> = QQ[]
sage: f = x+y
sage: parent(f(a,b))
Multivariate Polynomial Ring in a, b over Rational Field
sage: parent(f(x=a,y=b))
Multivariate Polynomial Ring in a, b over Rational Field
sage: parent(f(1,b))
Multivariate Polynomial Ring in a, b over Rational Field
But on the other hand, we have the inconsistency that started this
thread:
sage: parent(f(x=1,y=2))
Multivariate Polynomial Ring in x, y over Integer Ring
sage: parent(f(1,2))
Integer Ring
> The difficult case is what to do for f(x=5). Should that be the same
> as f(x=5, y=y) or a univariate polynomial?
I tend to believe that if you evaluate k variables of a polynomial
with n variables then the result should be a polynomial with n-k
variables. That having said, I wonder whether one should really make a
special case for k==n: Should the result be an element of the base
ring, or should it actually be a polynomial in zero variables?
Cheers,
Simon