[sage-support] Re: factor((A-B)*(B-C)).list() ?
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 expressions where the "n"-th element is the coefficient of "x^n" when self is seen as polynomial in "x". Therefore : sage: foo.list() [-b^2 + b*c, b - c] Is indeed the list of foo’s coefficients of powers of a. What you seek is : sage: foo.operands() [a - b, b - c] HTH, BTW, a better forum or this kind of questions is probably ask.sagemath.org. 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 Ubuntu): > var('A,B,C') factor((A-B)*(B-C)).list() > var('A,B,C') factor((A-B)*(B-C)).list() > > var('A,B,C') > factor((A-B)*(B-C)).list() > [-B^2 + B*C, B - C] > > I expected [B - A, B - C]. Any explanation? > > Kind regards, > > Roland > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/a893adfb-7a84-46e0-8c8c-b8df8b357034n%40googlegroups.com.
[sage-support] Re: factor((A-B)*(B-C)).list() ?
``` 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 expressions where the "n"-th element is the coefficient of "x^n" when self is seen as polynomial in "x". ``` Therefore : ``` sage: foo.list() [-b^2 + b*c, b - c] ``` Is indeed the list of foo's coefficients of powers of `a`. What you seek is : ``` sage: foo.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 Ubuntu): > var('A,B,C') factor((A-B)*(B-C)).list() > var('A,B,C') factor((A-B)*(B-C)).list() > > var('A,B,C') > factor((A-B)*(B-C)).list() > [-B^2 + B*C, B - C] > > I expected [B - A, B - C]. Any explanation? > > Kind regards, > > Roland > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/2b276448-dbf6-4b6a-83a2-01422f0e16c8n%40googlegroups.com.
[sage-support] Re: factor((A-B)*(B-C)).list() ?
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 Ubuntu): > var('A,B,C') factor((A-B)*(B-C)).list() > var('A,B,C') factor((A-B)*(B-C)).list() > > var('A,B,C') > factor((A-B)*(B-C)).list() > [-B^2 + B*C, B - C] > > I expected [B - A, B - C]. Any explanation? > > Kind regards, > > Roland > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/456c9fa5-1950-4e72-8017-9dcb1fe2cde4n%40googlegroups.com.
[sage-support] Re: .factor() output consistent?
Hi Roland, On 1 Mai, 12:08, Rolandb rola...@planet.nl wrote: sage: R.A,B=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.6.1) Both results are what you should expect. sage: type((A^2+B).factor()+(B^2).factor()) type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular' Hence, in your first example, you list a polynomial. The result is a list of pairs (c,m), where c is a coefficient and m is a monomial. sage: type((A^2+B).factor()) class 'sage.structure.factorization.Factorization' Hence, in your second example, you concatenate two lists that are obtained from two factorizations. When you list a factorisation, you obtain a list of pairs (x,d), where x is a factor and d is the exponent of that factor in the factorisation. Best regards, Simon -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: factor() behaving badly
On Sun, Dec 19, 2010 at 9:39 PM, John H Palmieri jhpalmier...@gmail.com wrote: On Dec 19, 7:01 pm, Alex Raichev tortoise.s...@gmail.com 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 Version 4.6, Release Date: 2010-10-30 | | Type notebook() for the GUI, and license() for information. | -- sage: R.x,y= PolynomialRing(QQ) sage: H= x^2*y^4 +y^6 +2*x^3*y^2 +2*x*y^4 -7*x^4 +7*x^2*y^2 +14*y^4 +6*x^3 +6*x*y^2 +47*x^2 +47*y^2 sage: for k in range(20): : print H.factor() : (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) Well, you could do sage: all([H==H.factor().prod() for k in range(20)]) True to doctest it. (I'm assuming that the prod method just does basic multiplication, and so its implementation has nothing to do with that of factor, so H==H.factor().prod() actually tests something meaningful.) +1 Probably worth noting the number of factors as well, e.g. sage: factorization = H.factor() sage: len(factorization) 2 sage: prod(factorization) == H True - Robert -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: factor() behaving badly
On Dec 19, 7:01 pm, Alex Raichev tortoise.s...@gmail.com 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 Version 4.6, Release Date: 2010-10-30 | | Type notebook() for the GUI, and license() for information. | -- sage: R.x,y= PolynomialRing(QQ) sage: H= x^2*y^4 +y^6 +2*x^3*y^2 +2*x*y^4 -7*x^4 +7*x^2*y^2 +14*y^4 +6*x^3 +6*x*y^2 +47*x^2 +47*y^2 sage: for k in range(20): : print H.factor() : (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (-x^2 - y^2) * (-y^4 - 2*x*y^2 + 7*x^2 - 14*y^2 - 6*x - 47) (x^2 + y^2) * (y^4 + 2*x*y^2 - 7*x^2 + 14*y^2 + 6*x + 47) Well, you could do sage: all([H==H.factor().prod() for k in range(20)]) True to doctest it. (I'm assuming that the prod method just does basic multiplication, and so its implementation has nothing to do with that of factor, so H==H.factor().prod() actually tests something meaningful.) -- John -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: factor
On Jun 17, 5:34 pm, William Stein wst...@gmail.com wrote: 2009/6/17 Robert Bradshaw rober...@math.washington.edu: 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 mathematical notation. I love the R[var] notation too. I remember making it up and being very pleased. Sure. However you cannot do R=ZZ[t] but must do R=ZZ['t'], and then do something else to get the variable t to be assigned to the variable which prints as 't'. that means either R.t=ZZ['t'] (which to a mathematician looks like double definition), or t = ZZ['t'].gen(0) which looks rather less mathematical (and does not end up giving the ring a name). Why can't these computers just know what we mean! Note the default variable name: sage: t = polygen(ZZ) sage: t x yes, that's good to point out. To make it t: sage: t = polygen(ZZ,'t') sage: t t Ahah! I think I have only ever used x, so I had not noticed that John Cremona William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
Hi William, On Jun 18, 12:14 pm, William Stein wst...@gmail.com wrote: ... You can also do sage: R.t = 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) that it can't be used in a python script, due to the missing Sage preparser. Cheers, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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.x. Clearly you are not using the preparser. What you could do is x = QQ['x'].gen(0) f = 2*x**2 - x f.factor() You can also do sage: preparse(x = QQ['x'].0) x = QQ['x'].gen(0) to see something that'll work in pure Python (assuming the needed imports). - Robert On Jun 16, 12:30 pm, David Joyner wdjoy...@gmail.com wrote: Is this what you mean? sage: R.x = 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, Mikiethephantom6...@hotmail.com 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 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 wst...@gmail.com wrote: On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washingtonhttp://wstein.org- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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 switch to rational coeffs: sage: x = polygen(QQ) sage: f = 2*x**2 - x sage: f.factor() (2) * (x - 1/2) * x Here 2 is the unit factor amd the other two are irreducible polynomials normalised to be monic, which makes sense over a field. John Cremona On Jun 17, 7:30 am, Robert Bradshaw rober...@math.washington.edu wrote: 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.x. Clearly you are not using the preparser. What you could do is x = QQ['x'].gen(0) f = 2*x**2 - x f.factor() You can also do sage: preparse(x = QQ['x'].0) x = QQ['x'].gen(0) to see something that'll work in pure Python (assuming the needed imports). - Robert On Jun 16, 12:30 pm, David Joyner wdjoy...@gmail.com wrote: Is this what you mean? sage: R.x = 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, Mikiethephantom6...@hotmail.com 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 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 wst...@gmail.com wrote: On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washingtonhttp://wstein.org-Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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 polynomial ring with integer coefficients. Note the difference when we switch to rational coeffs: sage: x = polygen(QQ) sage: f = 2*x**2 - x sage: f.factor() (2) * (x - 1/2) * x Here 2 is the unit factor amd the other two are irreducible polynomials normalised to be monic, which makes sense over a field. John Cremona Is there any particular reason why the x comes at the end instead of (2) * x * (x- 1/2) or (2 * x) * (x - 1/2) or 2 * x * (x - 1/2) just from a formatting perspective, any of these three I would generally prefer. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
On Wed, Jun 17, 2009 at 1:10 PM, Tim Laheytim.la...@gmail.com 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 the first line is that polynomials in x are elements of the polynomial ring with integer coefficients. Note the difference when we switch to rational coeffs: sage: x = polygen(QQ) sage: f = 2*x**2 - x sage: f.factor() (2) * (x - 1/2) * x Here 2 is the unit factor amd the other two are irreducible polynomials normalised to be monic, which makes sense over a field. John Cremona Is there any particular reason why the x comes at the end instead of The factors are sorted, I think in lex order, where x - 1/2 is internally [-1/2,1] and x is internally [0,1]. Notice that: sage: x=polygen(QQ) sage: f = 2*x**2 + x; factor(f) (2) * x * (x + 1/2) --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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 mathematical notation. Note the default variable name: sage: t = polygen(ZZ) sage: t x - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
2009/6/17 Robert Bradshaw rober...@math.washington.edu: 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 mathematical notation. I love the R[var] notation too. I remember making it up and being very pleased. Note the default variable name: sage: t = polygen(ZZ) sage: t x yes, that's good to point out. To make it t: sage: t = polygen(ZZ,'t') sage: t t William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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 wst...@gmail.com wrote: On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washingtonhttp://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
Is this what you mean? sage: R.x = 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, Mikiethephantom6...@hotmail.com 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 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 wst...@gmail.com wrote: On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washingtonhttp://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
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.x. On Jun 16, 12:30 pm, David Joyner wdjoy...@gmail.com wrote: Is this what you mean? sage: R.x = 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, Mikiethephantom6...@hotmail.com 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 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 wst...@gmail.com wrote: On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washingtonhttp://wstein.org- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: factor
On Mon, Jun 15, 2009 at 10:54 PM, Mikiethephantom6...@hotmail.com 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 Sage to do calculations from a form. When I put QQ['x'].0 into the sage script I get a systax on the period. It does work from the command line. Thanx -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---