[sage-support] Re: factor((A-B)*(B-C)).list() ?

2023-10-23 Thread Emmanuel Charpentier
sage: var("a, b, c") (a, b, c) sage: foo=(a-b)*(b-c) ; foo (a - b)*(b - c) Note that : sage: foo.expand() a*b - b^2 - a*c + b*c >From foo.list? : Docstring: Return the coefficients of this symbolic expression as a polynomial in x. INPUT: * "x" -- optional variable. OUTPUT: A list of expressio

[sage-support] Re: factor((A-B)*(B-C)).list() ?

2023-10-23 Thread Emmanuel Charpentier
``` sage: var("a, b, c") (a, b, c) sage: foo=(a-b)*(b-c) ; foo (a - b)*(b - c) ``` Note that : ``` sage: foo.expand() a*b - b^2 - a*c + b*c ``` >From `foo.list?` : ``` Docstring: Return the coefficients of this symbolic expression as a polynomial in x. INPUT: * "x" -- optiona

[sage-support] Re: factor((A-B)*(B-C)).list() ?

2023-10-23 Thread Emmanuel Charpentier
FWIW : sage: var("a, b, c") (a, b, c) sage: ((a-b)*(b-c)) (a - b)*(b - c) sage: ((a-b)*(b-c)).list() [-b^2 + b*c, b - c] sage: ((a-b)*(b-c)).operands() [a - b, b - c] HTH, ​ Le lundi 23 octobre 2023 à 18:23:32 UTC+2, Rolandb a écrit : > Hi, > > I am surprised by the output (9.8 and 10.1 Ubu

[sage-support] Re: .factor() output consistent?

2011-05-01 Thread Simon King
Hi Roland, On 1 Mai, 12:08, Rolandb wrote: > sage: R.=QQ[] > sage: list((A^2+B).factor()+(B^2).factor()) > [(1, A^2), (1, B^2), (1, B)] > sage: list((A^2+B).factor())+list((B^2).factor()) > [(A^2 + B, 1), (B, 2)] > > Is the first result what I could (should) expect? > (tested via KAIST, version 4

Re: [sage-support] Re: factor() behaving badly

2010-12-21 Thread Robert Bradshaw
On Sun, Dec 19, 2010 at 9:39 PM, John H Palmieri wrote: > On Dec 19, 7:01 pm, Alex Raichev wrote: >> Hi all: >> >> I get differently formatted answers using factor() multiple times on >> the same polynomial.  I wouldn't call it a bug, but it sure is >> annoying when doctesting. >> >> Alex >> >> -

[sage-support] Re: factor() behaving badly

2010-12-19 Thread John H Palmieri
On Dec 19, 7:01 pm, Alex Raichev wrote: > Hi all: > > I get differently formatted answers using factor() multiple times on > the same polynomial.  I wouldn't call it a bug, but it sure is > annoying when doctesting. > > Alex > > -

[sage-support] Re: factor

2009-06-18 Thread Simon King
Hi William, On Jun 18, 12:14 pm, William Stein wrote: ... > You can also do > > sage: R. = ZZ[] > > which doesn't look like a double definition. That's what I usually do. Sure. But when you see Mikie's post from June 17, this is what he did. The only problem was (as pointed out by other people

[sage-support] Re: factor

2009-06-18 Thread William Stein
On Thu, Jun 18, 2009 at 11:24 AM, John Cremona wrote: > > > > On Jun 17, 5:34 pm, William Stein wrote: >> 2009/6/17 Robert Bradshaw : >> >> >> >> > On Jun 17, 2009, at 4:05 AM, John Cremona wrote: >> >> >> I think is is easier, both on the eye and for a beginner to >> >> understand: >> >> >> sage

[sage-support] Re: factor

2009-06-18 Thread John Cremona
On Jun 17, 5:34 pm, William Stein wrote: > 2009/6/17 Robert Bradshaw : > > > > > On Jun 17, 2009, at 4:05 AM, John Cremona wrote: > > >> I think is is easier, both on the eye and for a beginner to > >> understand: > > >> sage: x = polygen(ZZ) > >> sage: f = 2*x**2 - x > >> sage: f.factor() > >>

[sage-support] Re: factor

2009-06-17 Thread William Stein
2009/6/17 Robert Bradshaw : > > On Jun 17, 2009, at 4:05 AM, John Cremona wrote: > >> I think is is easier, both on the eye and for a beginner to >> understand: >> >> sage: x = polygen(ZZ) >> sage: f = 2*x**2 - x >> sage: f.factor() >> x * (2*x - 1) > > Perhaps. I like the R[var] notation because

[sage-support] Re: factor

2009-06-17 Thread Robert Bradshaw
On Jun 17, 2009, at 4:05 AM, John Cremona wrote: > I think is is easier, both on the eye and for a beginner to > understand: > > sage: x = polygen(ZZ) > sage: f = 2*x**2 - x > sage: f.factor() > x * (2*x - 1) Perhaps. I like the R[var] notation because it's a direct translation of the mathemat

[sage-support] Re: factor

2009-06-17 Thread William Stein
On Wed, Jun 17, 2009 at 1:10 PM, Tim Lahey wrote: > > > On Jun 17, 2009, at 7:05 AM, John Cremona wrote: > >> >> I think is is easier, both on the eye and for a beginner to >> understand: >> >> sage: x = polygen(ZZ) >> sage: f = 2*x**2 - x >> sage: f.factor() >> x * (2*x - 1) >> >> The effect of t

[sage-support] Re: factor

2009-06-17 Thread Tim Lahey
On Jun 17, 2009, at 7:05 AM, John Cremona wrote: > > I think is is easier, both on the eye and for a beginner to > understand: > > sage: x = polygen(ZZ) > sage: f = 2*x**2 - x > sage: f.factor() > x * (2*x - 1) > > The effect of the first line is that polynomials in x are elements of > the polyn

[sage-support] Re: factor

2009-06-17 Thread John Cremona
I think is is easier, both on the eye and for a beginner to understand: sage: x = polygen(ZZ) sage: f = 2*x**2 - x sage: f.factor() x * (2*x - 1) The effect of the first line is that polynomials in x are elements of the polynomial ring with integer coefficients. Note the difference when we swit

[sage-support] Re: factor

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 3:10 PM, Mikie wrote: > > Yes, and as you can see it works great in sage command line. When I > use it in a python script I get a syntax error for the period in > R.. > Clearly you are not using the preparser. What you could do is x = QQ['x'].gen(0) f = 2*x**2 - x f.factor(

[sage-support] Re: factor

2009-06-16 Thread Mikie
Yes, and as you can see it works great in sage command line. When I use it in a python script I get a syntax error for the period in R.. On Jun 16, 12:30 pm, David Joyner wrote: > Is this what you mean? > > sage: R. = PolynomialRing(ZZ,"x") > sage: f = 2*x**2-x > sage: f.factor() > x * (2*x - 1

[sage-support] Re: factor

2009-06-16 Thread David Joyner
Is this what you mean? sage: R. = PolynomialRing(ZZ,"x") sage: f = 2*x**2-x sage: f.factor() x * (2*x - 1) On Tue, Jun 16, 2009 at 11:12 AM, Mikie wrote: > > When I use Sage to factor lets say 2*x**2-x it factors the  2 out and > leaves a fraction in the expression.  I would like to have it no

[sage-support] Re: factor

2009-06-16 Thread Mikie
When I use Sage to factor lets say 2*x**2-x it factors the 2 out and leaves a fraction in the expression. I would like to have it not factor the polynomial unless their is an integer factor. By the way I have created a Twisted API that works. On Jun 15, 4:51 pm, William Stein wrote: > On Mon,

[sage-support] Re: factor

2009-06-15 Thread William Stein
On Mon, Jun 15, 2009 at 10:54 PM, Mikie wrote: > > Is there anyway to get the factor function to factor an expression > without using QQ['x'].0?  I want just integer factors. I don't understand what you mean by "integer factors"? Can you give an example? > I have created a Twisted server using