Why factor(6*x+3) doesn't give 3*(2*x+1) in SageCell?

70 views
Skip to first unread message

Chris Seberino

unread,
Apr 6, 2017, 11:47:28 AM4/6/17
to sage-support
Why factor(6*x+3) doesn't give 3*(2*x+1) ?

Thanks!

cs

Christophe Bal

unread,
Apr 6, 2017, 12:17:36 PM4/6/17
to sage-s...@googlegroups.com
Hello 

Havr you try to work with ZZ[X] ?

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

Ralf Stephan

unread,
Apr 7, 2017, 4:04:01 AM4/7/17
to sage-support
Because in the symbolic ring 3*(2*x+1) is immediately expanded again. Try yourself:

sage: 2*(1+3*x)
6*x + 2


Regards,

Chris Seberino

unread,
Apr 7, 2017, 10:42:45 AM4/7/17
to sage-support
No

Christophe BAL (via GMAIL)

unread,
Apr 7, 2017, 10:56:31 AM4/7/17
to sage-s...@googlegroups.com
Just try :

---------------------------------
Z_T, t = ZZ['x'].objgen()

print factor(6*t+3)
print factor(6*x+3)
---------------------------------

You will se that you need to use the right ring of polynomials.

C.

Chris Seberino

unread,
Apr 7, 2017, 11:29:39 AM4/7/17
to sage-support
I *agree* that the answer should be expanded in your example.
But when you use the factor function it should have an effect no!?

(I saw the other reply about rings.  See my reply to that if you wish too.)

Chris Seberino

unread,
Apr 7, 2017, 12:18:34 PM4/7/17
to sage-support
I have no doubt you know about group theory and math in general more than me.  I have no doubt
your answer is defensible and accurate.  

What I'm concerned about is the young students and what they expect to see when
they type factor( ... ).

cs

Dima Pasechnik

unread,
Apr 7, 2017, 6:02:23 PM4/7/17
to sage-support


On Friday, April 7, 2017 at 5:18:34 PM UTC+1, Chris Seberino wrote:
I have no doubt you know about group theory and math in general more than me.  I have no doubt
your answer is defensible and accurate.  

What I'm concerned about is the young students and what they expect to see when
they type factor( ... ).

They have to get used to the fact that the answer depends upon the domain the object they factor
comes from. Think e.g. about x^2-2  factored as (x-sqrt(2))*(x+sqrt(2))  --- or not, if we only allow rational
coefficients in our polynomials. Or x^2+1 being factored as (x-i)*(x+i)  --- or not, if we only allow real coefficients...

Ralf Stephan

unread,
Apr 8, 2017, 1:59:48 AM4/8/17
to sage-support
On Friday, April 7, 2017 at 5:29:39 PM UTC+2, Chris Seberino wrote:
I *agree* that the answer should be expanded in your example.
But when you use the factor function it should have an effect no!?

That's why I gave the link to the ticket, which you can follow or participate in. 

saad khalid

unread,
Apr 8, 2017, 4:21:17 PM4/8/17
to sage-support
I am a student and I definitely agree with Chris Seberino here. I don't think it is the job of software (or, rather, it is not good CAS design) to try and teach people mathematics in this way. I think that the CAS should be as convenient and intuitive as possible. As an example, I didn't even know that the functionality with rings that projetmbc highlights in his post was even possible, I simply assumed that Sage was limited in how it could do factorization. This is coming from someone who, in comparison to the rest of the math students at his school, is much more willing to read the documentation and fiddle with the function and google for solutions than most others, and I still didn't find this out till just now (and not for lack of searching on previous occasions, I should say). Also, w/ respect to Dima's statement about getting used to domains, I do not think that is exactly related here. The "Symbolic ring" which has the property of defaulting to the most expanded form of an expression is not a mathematical concept that I have ever heard of, it is behaviour that is part of Sage. It is behaviour that is very disconcerting for a new user using the factor function. I should add, on what I believe to be an unrelated note, that even if we were debating whether factorization should default to the reals or the complex numbers or something similar, I would argue that it should default to the most widely utilized behaviour, with the other options being left as just that, options (that you can turn on by keyword). So in the case of factoring to reals or complex roots, I would say that it should default to real roots, with a keyword allowing complex roots. Back to the main point, I do wish the factor function was made more intuitive, and that factoring in SR would recognize when it is integers and actually do something instead of giving you back what you put in.


Chris Seberino

unread,
Apr 11, 2017, 12:59:06 PM4/11/17
to sage-support
Saad:

Thanks.  What would (hopefully) please everyone is if there was a way to configure the way Sage Cell behaves similar to how
local installations can write stuff to a config file.

Is there a way to hardcode the real domain/range and other things like implicit multiplication?

cs
Reply all
Reply to author
Forward
0 new messages