#466 closed bug (wontfix)
ignoring denominators
Reported by: | Owned by: | hannes | |
---|---|---|---|
Priority: | minor | Milestone: | 3-1-6 and higher |
Component: | singular-kernel | Version: | 3-1-5 |
Keywords: | subst, parameters, trans. ext | Cc: |
Description (last modified by )
I don't know if you call this a bug or a feature:
> ring r=(0,a,b,c),x,dp; > poly p=x^2+a*x+b; > poly p1=subst(p,a,(1+c^2)/(2*c),b,(1-c^2)/(2*c)); // ** ignoring denominators of coefficients... > p1; x2+(c2+1)*x+(-c2+1)/(2c)
at least the result is not correct. I really don't understand the logic of this. In addition a and b are treated differently. Anyway how to get the correct result?
Change History (8)
comment:1 follow-up: 2 Changed 10 years ago by
comment:2 Changed 10 years ago by
Replying to motsak:
What Singular are you using? Maybe you could provide the output of "Singular -v"?
Thanks for reporting.
I have version 3-1-3 for windows. I don't know what you mean by output of "Singular -v"?
comment:3 Changed 10 years ago by
Component: | dontKnow → singular-kernel |
---|---|
Keywords: | subst parameters trans. ext added |
Owner: | changed from somebody to hannes |
Version: | 3-1-5 → 3-1-3 |
comment:4 Changed 10 years ago by
Description: | modified (diff) |
---|
comment:5 Changed 10 years ago by
Version: | 3-1-3 → 3-1-5 |
---|
It is really strange (using recent master
Singular) as only two-fold subst leads to the error:
> ring r=(0,a,b,c),x,dp; poly p=x^2+a*x+b; > subst(p,a,(1+c^2)/(2*c)); // correct!!! x2+(c2+1)/(2c)*x+(b) > subst(p,b,(1-c^2)/(2*c)); // correct!!! x2+(a)*x+(-c2+1)/(2c) > subst(subst(p,a,(1+c^2)/(2*c)),b,(1-c^2)/(2*c)); // wrong! // ** ignoring denominators of coefficients... x2+(c2+1)*x+(-c2+1)/(2c) > subst(subst(p,b,(1-c^2)/(2*c)),a,(1+c^2)/(2*c)); // wrong!! // ** ignoring denominators of coefficients... x2+(c2+1)/(2c)*x+(-c2+1)
comment:6 follow-up: 7 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
As the error message say: one can only use subst for parameters as long as your coefficients are polynomials. This is true for the first 2 examples of comment5, but not for the combined examples 3 and 4. The manual now includes a warning about this.
comment:7 Changed 10 years ago by
Replying to hannes:
As the error message say: one can only use subst for parameters as long as your coefficients are polynomials. This is true for the first 2 examples of comment5, but not for the combined examples 3 and 4. The manual now includes a warning about this.
what do you mean by "coeffiecients are polynomials"? i don't understand how this would be different in the above examples where sometimes one gets the correct result and sometimes not.
what kind of warning the manual has and where it can be found?
perhaps more importantly why does singular ignore the denominators in the first place? this simply doesn't seem to make any sense anyway.
comment:8 Changed 10 years ago by
A solution has been given in the forum: http://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1806&start=0&hilit=parsubst
There I have provided a proc parsubst which does does the job:
proc parsubst(poly f,number t,number q) " USAGE: parsubst(f,t,q); f poly or number, t number, q number RETURN: poly, resp. number as the input type ASSUME: t is a parameter of the basering EXAMPLE: example parsubst; shows an example " { int is_constant = deg(f)==0; if (is_constant) { f = f*var(1); } // f was a number int zero_const_term = jet(f,0)==0; if (zero_const_term) { f = f + 1;} //otherwise denom is lost poly g = cleardenom(f); number commondenom = leadcoef(g)/leadcoef(f); f = subst(g,t,q)/subst(commondenom,t,q); if (zero_const_term) { f = f - 1;} if(is_constant) { f = f/var(1);} return(f); }
Now your example works as desired:
> ring r=(0,a,b,c),x,dp; > poly p=x^2+a*x+b; > parsubst(parsubst(p,a,(1+c^2)/(2*c)),b,(1-c^2)/(2*c)); x2+(c2+1)/(2c)*x+(-c2+1)/(2c)
What Singular are you using? Maybe you could provide the output of "Singular -v"?
Thanks for reporting.