sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.4k stars 474 forks source link

Bug in showing the substitution of a variable with a custom "latex_name" in a multivariate polynomial #27905

Open Miguel-OYeah opened 5 years ago

Miguel-OYeah commented 5 years ago

Sage version: SageMath version 8.7, Release Date: 2019-03-23

Minimal reproducible example:

%typeset_mode True
var("k1,k2,k3,k4,a1,b1,c1,d1") # Let's define some parameters
R.<p,q> = SR[] # Variables of the polynomial
poly= (c1*k1)*p*q + (c1*k2 + a1)*p + (c1*k3 + b1)*q + c1*k4 + d1 # Simple bilinear function in p and q
poly.subs(p=var("alpha")) # ---> Shows correct substitution
poly.subs(p=var("gamma",latex_name=r"\color{blue}{\gamma}", domain="real")) # ---> Shows incorrect substitution
# BUT
print(poly.subs(p=var("gamma",latex_name=r"\color{blue}{\gamma}", domain="real"))) # ---> Shows CORRECT substitution

It is a bug while showing the polynomial, but not while substituting because the print() shows the correct result.

Component: notebook

Issue created by migration from https://trac.sagemath.org/ticket/27905

Miguel-OYeah commented 5 years ago

Attachment: Output - CoCalc.png

Sample_output

embray commented 5 years ago
comment:1

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

embray commented 5 years ago
comment:2

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).