Hi,

+1, that seems to make sense, and it's a good idea to have both
semantics available.

Note that there are also complicated mixes:

sage: R.<x> = RR[]
sage: Zxy = PolynomialRing(ZZ,'x,y,z')
sage: xx,yy,zz = Zxy.gens()
sage: (xx+yy).subs(x=x).parent()
Multivariate Polynomial Ring in x, y, z over Real Field with 53 bits of 
precision
sage: (xx+yy)(x=x).parent()
Multivariate Polynomial Ring in x, y, z over Real Field with 53 bits of 
precision

Your proposal is that the latter should only be RR[x,y], I guess?

Best,
Johan


Jonas Jermann writes:

> Hi
>
> +1 by me.
> How is the order of variables for "call" determined?
> How would this work for SR?
>
>
> Regards
> Jonas
>
> On 06.12.2015 15:24, Vincent Delecroix wrote:
>> Hello,
>>
>> We have substitution available for various objects (e.g. matrices when
>> the base ring is a polynomial ring). I would like to fix the conventions
>> of the parent of
>>
>>   my_object.subs(var1=val1, var2=val2)
>>
>> versus
>>
>>   my_object(var1=val1, var2=val2)
>>
>> With .subs, univariate polynomial ring somehow chooses the "minimal ring"
>>
>>      sage: R.<x> = ZZ[]
>>      sage: (x+3).subs(x=2).parent()
>>      Integer Ring
>>      sage: (x+3).subs(x=x+4).parent()
>>      Univariate Polynomial Ring in x over Integer Ring
>>      sage: (x+3).subs(x=4.).parent()
>>      Real Field with 53 bits of precision
>>
>> Whereas multivariate are somehow "undecided"
>>
>>      sage: (x+3).subs(x=2).parent()
>>      Multivariate Polynomial Ring in x, y over Integer Ring
>>      sage: (x+3).subs(x=x+4).parent()
>>      Multivariate Polynomial Ring in x, y over Integer Ring
>>      sage: (x+3).subs(x=4.).parent()
>>      Real Field with 53 bits of precision
>>
>> Whereas the symbolic ring is as always a black hole
>>
>>      sage: x = SR('x')
>>      sage: x.subs(x=3.).parent()
>>      Symbolic Ring
>>      sage: x(x=3.).parent()
>>      Symbolic Ring
>>
>> My proposition is:
>>
>>   - .subs should be considered as an *internal* operation. Hence, the
>> result will always be in the same parent (or the result of a pushout).
>> In particular we would have
>>
>>      sage: R.<x> = ZZ[]
>>      sage: x.subs(x=4).parent()
>>      Univariate Polynomial Ring in x over Integer Ring
>>      sage: x.subs(x=4.).parent()
>>      Univariate Polynomial Ring in x over Real Double Field
>>
>> - __call__ is considered as an external operation. The result should
>> (more or less) be the smallest parent in which the result belong.
>>
>>      sage: R.<x,y> = ZZ[]
>>      sage: x(3,5).parent()
>>      Integer Ring
>>      sage: (x+y)(3., polygen(ZZ))
>>      Univariate Polynomial Ring in x over Real Field with 53 bits of
>> precision
>>
>> Does it look reasonable?
>>
>> Best,
>> Vincent
>>

-- 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to