[sage-support] Re: Polynomial of roots of polynomial over the primitive element

2020-02-20 Thread Pedro Vinícius Ferreira Baptista
Yes I wanted the splitting field. I didn't know exactly the terminology of all this things as I'm still learning most of it. One more question. Would you happen to know any source that I can look into it to see how or at least the vague idea of how the splitting field and the factors are calcul

[sage-support] Re: Polynomial of roots of polynomial over the primitive element

2020-01-02 Thread Brent W. Baccala
On Tuesday, November 19, 2019 at 1:35:24 AM UTC-5, Pedro Vinícius Ferreira Baptista wrote: > > Given an irreducible polynomial P from Q[x] I want to find the primitive > element A of the extension field defined by it. > Moreover I want to know how to write the roots of P in terms of A(per > exa

[sage-support] Re: Polynomial factorization over modular ring

2017-08-15 Thread Ralf Stephan
On Tuesday, August 15, 2017 at 4:21:03 PM UTC+2, chandra chowdhury wrote: > > x = var('x') > factor(x^5-x, IntegerModRing(25)['x']) > Look at the output of `factor??`. A ring argument is not supported. So you have to create the ring first (var gives you only the symbolic ring). Then create the

Re: [sage-support] Re: Polynomial factorization over modular ring

2017-08-15 Thread John Cremona
On 15 August 2017 at 18:42, Nils Bruin wrote: > On Tuesday, August 15, 2017 at 7:21:03 AM UTC-7, chandra chowdhury wrote: >> >> Is it possible to factor polynomials completely over modular ring? >> >> Like >> x = var('x') >> factor(x^5-x, IntegerModRing(25)['x']) >> gives >> >> (x-1)(x+1)(x^2+1)*x

[sage-support] Re: Polynomial factorization over modular ring

2017-08-15 Thread Nils Bruin
On Tuesday, August 15, 2017 at 7:21:03 AM UTC-7, chandra chowdhury wrote: > > Is it possible to factor polynomials completely over modular ring? > > Like > x = var('x') > factor(x^5-x, IntegerModRing(25)['x']) > gives > > (x-1)*(x+1)*(x^2+1)*x > The second argument is simply ignored here, by the

[sage-support] Re: Polynomial division without remainder

2014-03-25 Thread Nils Bruin
On Monday, March 24, 2014 7:56:33 AM UTC-7, martin@gmx.net wrote: > > Working in a stack of multivariate polynomial rings, how can I compute the > quotient of two polynomials in those cases where I know the remainder to be > zero? > > Reading the docs I found two likely approaches, but neithe

[sage-support] Re: Polynomial rings and homogenization

2014-03-06 Thread Tristan
Hi Peter, Thanks for your suggestion, it's something I hadn't considered specifying for all of my variables. I managed to avoid the '_first_ngens' by restructuring the code, and your comment about making sure that everything is actually an integer saved me a lot of time fixing the next error.

[sage-support] Re: Polynomial rings and homogenization

2014-03-05 Thread Peter Bruin
Hello Tristan, > n = 100; d=3 > load DATA+'my_functions.py' > coefficients = poly_expand(n,int(n**(1/d)),d) > R. = ZZ[] > f = 0 > for c in coefficients: > f += c*t^d > d -= 1 > g = f.homogenize('s') > > Running this returns "AttributeError: 'GlobalPolynomialRing' object has no > attribu

[sage-support] Re: Polynomial question.

2013-12-11 Thread P Purkayastha
On 12/11/2013 08:40 PM, Thierry Dumont wrote: Hello, all, I am going to manipulate Legendre (P) polynomials. So I do something like this: sage: P.=QQ[] sage: #generate de first Lagrange polynomial sage: s=[legendre_P(i,x) for i in [0..2]] sage: print s [1, x, 3/2*x^2 - 1/2] sage: #now, look a

Re: [sage-support] Re: Polynomial quotient and reminder

2013-04-18 Thread Andrea Lazzarotto
2013/4/18 Simon King > A symbolic expression is something fairly general---so general that many > methods won't make sense in this generality. A symbolic expression may > contain all "strange" stuff like sin(x^2), exp(pi), x^x, etc. > > From computer science point of view, the mathematical algo

[sage-support] Re: Polynomial quotient and reminder

2013-04-17 Thread Simon King
Hi Andrea, On 2013-04-17, Andrea Lazzarotto wrote: >> Note that by saying >> S(x) = ... >> you define S as a symbolic function on a symbolic variable x, and if you >> re-define x later, then the variable of S will still be symbolic, and >> not belong to a polynomial ring. >> > > Ok, my bad

[sage-support] Re: Polynomial quotient and reminder

2013-04-17 Thread Andrea Lazzarotto
Hi, > The problem is that in fact you are *not* considering two polynomials: > [...] > > Note that by saying > S(x) = ... > you define S as a symbolic function on a symbolic variable x, and if you > re-define x later, then the variable of S will still be symbolic, and > not belong to a p

[sage-support] Re: Polynomial quotient and reminder

2013-04-17 Thread Simon King
Hi Andrea, On 2013-04-17, Andrea Lazzarotto wrote: > Hi, I am trying to work with polynomials in Finite Fields. We have to > implement the Extended Euclidean Algorithm for using it with Reed Solomon > Codes. > ... > Now my problem is that I would like to divide a by b and get bot the quotient

[sage-support] Re: polynomial remainder

2013-01-18 Thread Michael Beeson
Sage hangs on the following input: sage: K. = FractionField(PolynomialRing(QQ,4,'pdeN')) sage: R. = K[] sage: a = x-x^-1 sage: b = x^6-x^-6 sage: c = x^7-x^-7 sage: X = p*a + d*b + e*c sage: F = N*a*b*c - X^2*(x-x^-1) and also on this closely related input sage: K. = FractionField(PolynomialRing

[sage-support] Re: polynomial division

2013-01-06 Thread John Cremona
Easy, you just need to define the ring Q(a)[x] like this: sage: K. = FractionField(PolynomialRing(QQ,'a')) sage: R. = K[] sage: f = x^2+1 sage: g = a*x sage: f.quo_rem(g) (1/a*x, 1) On Sunday, April 22, 2012 9:23:53 PM UTC+1, Michael Beeson wrote: > > Sage version 4.6.1 (I know it's old, new on

[sage-support] Re: polynomial division

2013-01-05 Thread Michael Beeson
I want to take, for example, x^2 + 1 mod a*x and get quotient (1/a)*x and remainder 1.It doesn't work if I work in PolynomialRing because then you can't have 1/a. It doesn't work in the quotient field because then you always get remainder 0.To have f.quo_rem(g) work, I must a

[sage-support] Re: Polynomial of roots as function of coefficient

2012-08-20 Thread Anthony Wickstead
Can't help with Sage, but Mathematica 8.0 has no function SymmetricReduce. It does have SymmetricReduction: SymmetricReduction[f,{Subscript[x, 1],...,Subscript[x, n]}] gives a pair of polynomials {p,q} in Subscript[x, 1],...,Subscript[x, n] such that f==p+q, where p is the symmetric part and q

Re: [sage-support] Re: Polynomial representation over GF(2^n)

2012-06-16 Thread Martin Albrecht
On Wednesday 13 Jun 2012, Oleksandr Kazymyrov wrote: > And one more. > > The following is quite strange: > sage: K=GF(2^8,'a',modulus=ZZ['x']("x^8 + x^7 + x^6 + x^4 + x^3 + x^2 + > 1")) sage: b=K.multiplicative_generator() > sage: c=K(0) > sage: c.log(b) > 0 > sage: c=K(1) > sage: c.log(b) > 0 >

[sage-support] Re: Polynomial representation over GF(2^n)

2012-06-13 Thread Oleksandr Kazymyrov
And one more. The following is quite strange: sage: K=GF(2^8,'a',modulus=ZZ['x']("x^8 + x^7 + x^6 + x^4 + x^3 + x^2 + 1")) sage: b=K.multiplicative_generator() sage: c=K(0) sage: c.log(b) 0 sage: c=K(1) sage: c.log(b) 0 How to determine when c is 0 and when 1? Perhaps log should return -1 for fi

[sage-support] Re: Polynomial over GF(16)

2012-05-08 Thread ArturZ
I found the error. The following one is correct now: F.=GF(16) for b, c in F^2 : print "x=",b,"y=",c, "T:",b*custom_divide((custom_divide(b,c))^4+a*( custom_divide(b,c))^2+1,a*((custom_divide(b,c))^3+1)+(a^3+a^2)*(( custom_divide(b,c))^2+custom_divide(b,c)))+(b*c).nth_root(2) W dniu wto

[sage-support] Re: Polynomial over GF(16)

2012-05-08 Thread ArturZ
Simple explanation of my problem (if the previous one was too complicated): Let GF(2^4)={0, 1, a, a+1, a^2, a^2+1, a^2+a, a^2+a+1, a^3, a^3+1, a^3+a, a^3+a+ 1, a^3+a^2, a^3+a^2+1, a^3+a^2+a, a^3+a^2+a+1} and a^4+a+1=0. Let T:= x*([c^2((y/x)^4+(y/x))+c^2(1+c+c^2)((y/x)^3+(y/x))]/[(y/x)^4+c(y/x

[sage-support] Re: polynomial division

2012-04-22 Thread Volker Braun
Because you divided by x in your computation, the polynomial f was coerced into the fraction field. In the fraction field, quotient is always possible without reminder: sage: f.parent() Fraction Field of Multivariate Polynomial Ring in x, N, p, r, m, l over Rational Field You want to convert f

[sage-support] Re: Polynomial input as product of factors without * between them

2011-03-26 Thread Surendran Karippadath
The Deprecation warning was absent in 4.3.3 but is there in 4.6.2. Does this mean consecutive brackets are treated as Lamda expressions scoping to the right? Like: sage : y=1/((x-1)(x-3)(x-5)) sage : y 1/(x-9) sage : y=1/((x-1)(x-3)(x^2-5)) sage : y 1/(x^2-9) sage : y=1/((x-1)

[sage-support] Re: Polynomial input as product of factors without * between them

2011-03-25 Thread John H Palmieri
On Friday, March 25, 2011 9:35:13 PM UTC-7, Surendran Karippadath wrote: > > If the multiplication sign * is absent ( say by mistake!) what is SAGE > evaluating? > For example: > x=var('x');f=1/((x-1)(x-3)); > f.limit(x=1) returns -1/3 > diff(f,x) returns -1/(x - 4)^2 > plot(f,(x,0,10)) plo

[sage-support] Re: polynomial interpolation

2010-12-24 Thread Jason Grout
On 12/24/10 5:40 AM, lainme wrote: Hi, I want to do polynomial interpolation with sage, such as the Lagrange Interpolation I searched the group and reference manual of sage, but only found the complex interpolation. I made this for my numerical analysis class: http://demo.sagenb.org/home/pub

Re: [sage-support] Re: Polynomial

2010-12-04 Thread Santanu Sarkar
Yes, exactly 12xy= 24x+36y. On 5 December 2010 00:22, JamesHDavenport wrote: > > > On Dec 4, 5:14 pm, Santanu Sarkar > wrote: > > Consider a collection of polynomials over three variables x, y, z. > > Suppose, we replace monomial xy by 2x+3y for each polynomial. > > And also each multiple of xy

[sage-support] Re: Polynomial

2010-12-04 Thread JamesHDavenport
On Dec 4, 5:14 pm, Santanu Sarkar wrote: > Consider a collection of polynomials over three variables x, y, z. > Suppose, we replace monomial xy by 2x+3y for each polynomial. > And also each multiple of xy say xyz will be replaced by z(2x+3y). Therefore (xy)*(xy) will be (2x+3y)*(2x+3y) which has

Re: [sage-support] Re: polynomial division by increasing powers

2010-11-17 Thread Johannes Huisman
Hi Simon! On 11/17/2010 08:33 AM, Simon King wrote: On 16 Nov., 23:48, Johannes Huisman wrote: Does sage have a command for polynomial division by increasing powers? I could not find such a command. Of course, one may use power series division in order to compute the quotient, but it would be n

[sage-support] Re: polynomial division by increasing powers

2010-11-16 Thread Simon King
Hi Johannes! On 16 Nov., 23:48, Johannes Huisman wrote: > Does sage have a command for polynomial division by increasing powers? I > could not find such a command. Of course, one may use power series > division in order to compute the quotient, but it would be neat if one > could avoid all that.

[sage-support] Re: polynomial constructor from roots

2010-10-25 Thread John Cremona
Andrew, Read up on resultants: sage: R.=QQ[] sage: f=x^2+a1*x+a2 sage: g=x^2+b1*x+b2 sage: f(x=y).resultant(g(x=x-y),variable=y) a1^2*b1*x + a1*b1^2*x + a1^2*x^2 + 3*a1*b1*x^2 + b1^2*x^2 + 2*a1*x^3 + 2*b1*x^3 + x^4 + a1*a2*b1 + a2*b1^2 + a1^2*b2 + a1*b1*b2 + 2*a1*a2*x + 2*a2*b1*x + 2*a1*b2*x + 2*

Re: [sage-support] Re: polynomial constructor from roots

2010-10-24 Thread andrew ewart
is there a way of doing what uve done except considering the pair of polynomials x^2+a1*x+a0 x^2+b1*x+b0 where a0,a1,b0,b1 lie in QQ but their exact values r not known and al is a root of the first and be is a root of the second? On Sun, Oct 24, 2010 at 5:22 PM, Yann wrote: > On Oct 23, 9:39

[sage-support] Re: polynomial constructor from roots

2010-10-24 Thread Yann
On Oct 23, 9:39 pm, andrew ewart wrote: > if alpha is a root of x^2+a_1*x+a_0 and beta is a root of x^2+b_1*x > +b_0 (both polynomials r in QQ), then how do i construct code such > that it can tell me the minimum polynomials of the following roots > alpha+beta > and > alpha*beta Hi, I'm not sure

Re: [sage-support] Re: Polynomial mod

2010-04-28 Thread Robert Bradshaw
On Apr 28, 2010, at 6:04 AM, Yann wrote: This at least documented: sage: R.=ZZ[] sage: f = x^3+x+1 sage: f.mod? ... When little is implemented about a given ring, then mod may return simply return f. For example, reduction is not implemented for ZZ[x] yet. (TODO!) s

[sage-support] Re: Polynomial mod

2010-04-28 Thread Yann
This at least documented: sage: R.=ZZ[] sage: f = x^3+x+1 sage: f.mod? ... When little is implemented about a given ring, then mod may return simply return f. For example, reduction is not implemented for ZZ[x] yet. (TODO!) sage: R. = PolynomialRing(ZZ) sage: f = x

Re: [sage-support] Re: Polynomial Independence

2010-04-25 Thread Santanu Sarkar
Thank you very much for your kind help. On 25 April 2010 17:00, Simon King wrote: > On 25 Apr., 12:50, Santanu Sarkar > wrote: > > Sorry again. Dependency needs over integer. > > Probably there is a better way of doing it, but the following works: > > Transform the problem into a matrix: One ro

[sage-support] Re: Polynomial Independence

2010-04-25 Thread Simon King
On 25 Apr., 12:50, Santanu Sarkar wrote: > Sorry again. Dependency needs over integer. Probably there is a better way of doing it, but the following works: Transform the problem into a matrix: One row for each polynomial, one column for each monomial that occurs in one of the polynomials, and th

Re: [sage-support] Re: Polynomial Independence

2010-04-25 Thread Santanu Sarkar
Sorry again. Dependency needs over integer. On 25 April 2010 16:06, Simon King wrote: > Hi! > > On 25 Apr., 12:26, Santanu Sarkar > wrote: > > I want to find linear dependence of the set polynomials {f1,f2,f1*f2, > > x1*f2,x2*f2} > > 'Linear over ZZ' or 'linear over R'? > > If it is the latter,

[sage-support] Re: Polynomial Independence

2010-04-25 Thread Simon King
Hi! On 25 Apr., 12:26, Santanu Sarkar wrote: > I want to find linear dependence of the set polynomials {f1,f2,f1*f2, > x1*f2,x2*f2} 'Linear over ZZ' or 'linear over R'? If it is the latter, the following might help (but is only implemented if you have polynomials over a field, not over ZZ): sa

Re: [sage-support] Re: Polynomial Independence

2010-04-25 Thread Santanu Sarkar
Hi, No, my polynomials are not homogeneous and are of different degree. Suppose: R.=ZZ[] f1=1+x1+x2+x1*x2 f2=1+x1+x3+x1*x3 I want to find linear dependence of the set polynomials {f1,f2,f1*f2, x1*f2,x2*f2} With regards, Santanu On 25 April 2010 15:33, Simon King wrote: > Hi! > > On 25 Apr.,

[sage-support] Re: Polynomial Independence

2010-04-25 Thread Simon King
Hi! On 25 Apr., 11:41, Santanu Sarkar wrote: >  Suppose f1, f2,,f10 are polynomials over 20 variables over integers. > How one can check weather they are linearly independent or not in Sage? When you talk about linear indepence of polynomials, you probably assume that they are all homogeneou

[sage-support] Re: Polynomial printing convention

2010-02-11 Thread Simon King
Hi Zach! On Feb 11, 2:37 pm, zsharon wrote: > This should also work: > > R. = PowerSeriesRing(ZZ) > z+1 > #1+z I am a bit surprised that it works, because I thought that PowerSeriesRing comes with a default precision of 20. So, I thought that any polynomial would be cut off in degree 20. But in

[sage-support] Re: Polynomial printing convention

2010-02-11 Thread zsharon
> How about this: This should also work: R. = PowerSeriesRing(ZZ) z+1 #1+z See http://www.sagemath.org/doc/tutorial/tour_polynomial.html for other examples. Zach -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+

[sage-support] Re: Polynomial printing convention

2010-02-11 Thread zsharon
> > But there are people who would (at least if the context is formal > power series) prefer >   1 + 6*t + 4*t^2 > > Is there a way to switch between these to conventions? > How about this: R. = LaurentSeriesRing(QQ) x^3+x+1 #1 + x + x^3 Zach -- To post to this group, send email to sage-suppor

Re: [sage-support] Re: polynomial remainder

2010-01-05 Thread William Stein
On Tue, Jan 5, 2010 at 12:37 AM, Michael Beeson wrote: > Thanks,  that's a start,  but my polynomials have some parameters > a,b,c,... > in the coefficients.  In Mathematica you say PolyomialRemainder[f,g,x] > where the > last 'x'  names the polynomial variable, so all other variables are > parame

[sage-support] Re: polynomial remainder

2010-01-05 Thread Yann
On 5 jan, 09:37, Michael Beeson wrote: > Thanks,  that's a start,  but my polynomials have some parameters > a,b,c,... > in the coefficients.  In Mathematica you say PolyomialRemainder[f,g,x] > where the > last 'x'  names the polynomial variable, so all other variables are > parameters.  When >

[sage-support] Re: polynomial remainder

2010-01-05 Thread Michael Beeson
Thanks, that's a start, but my polynomials have some parameters a,b,c,... in the coefficients. In Mathematica you say PolyomialRemainder[f,g,x] where the last 'x' names the polynomial variable, so all other variables are parameters. When I tried to modify your code by inserting a=var('a') an

[sage-support] Re: polynomial remainder

2010-01-04 Thread Jason Grout
bump wrote: > > On Jan 3, 10:59 am, Michael Beeson wrote: >> I am just learning Sage. I tried to define a polynomial and then >> find the polynomial remainder upon division by the >> cyclotomic_polynomial(18), which is 1-x^3+x^6.This is easily >> accomplished in Mathematica using the Polyno

[sage-support] Re: polynomial remainder

2010-01-03 Thread bump
On Jan 3, 10:59 am, Michael Beeson wrote: > I am just learning Sage.   I tried to define a polynomial and then > find the polynomial remainder upon division by the > cyclotomic_polynomial(18), which is 1-x^3+x^6.    This is easily > accomplished in Mathematica using the PolynomialRemainder funct

[sage-support] Re: Polynomial approximation of a function

2009-11-02 Thread Nathann Cohen
Thank you for your answers !! I was thinking about some multidimensional linear approximation, where the basis you use is ( for points of coordinates (x_i, y_i ) ) the vectors The family of x_i, x_i The family of x_i, x_i^2 The family of x_i, x_i^3 The family of x_i, x_i^4 ... But it turns out S

[sage-support] Re: Polynomial approximation of a function

2009-11-02 Thread Jason Grout
Robert Bradshaw wrote: > On Nov 2, 2009, at 8:41 AM, Nathann Cohen wrote: > >> Hello !!! >> >> I remember there is an easy way ( through matrices ) to get the >> "best" approximation of a function by a polynomial of bounded degree >> ( and not only the usual approximation by a line ) I lo

[sage-support] Re: Polynomial approximation of a function

2009-11-02 Thread Robert Bradshaw
On Nov 2, 2009, at 8:41 AM, Nathann Cohen wrote: > Hello !!! > > I remember there is an easy way ( through matrices ) to get the > "best" approximation of a function by a polynomial of bounded degree > ( and not only the usual approximation by a line ) I looked for > such functions in S

[sage-support] Re: Polynomial approximation of a function

2009-11-02 Thread Laurent
Nathalie Cohen ha scritto: > Hello !!! > > I remember there is an easy way ( through matrices ) to get the "best" > approximation of a function by a polynomial of bounded degree ( and not only > the usual approximation by a line ) Are you speaking about the Taylor expansion ? If so, it is impl

[sage-support] Re: Polynomial over a finite field using integer coefficients

2009-09-22 Thread Simon King
Hi! On 22 Sep., 20:08, Shing Hing Man wrote: > Thanks for the  reply! > Just one more question. > In general, if k is a finite field, what is k(i), where i is an > integer, suppose to be ? Apart from the autocompletion, another useful way to get information is to look into the documentation. T

[sage-support] Re: Polynomial over a finite field using integer coefficients

2009-09-22 Thread Shing Hing Man
Thanks for the reply! Just one more question. In general, if k is a finite field, what is k(i), where i is an integer, suppose to be ? The following example suggests k(i) will be the elements in the base field as i varies. sage: k. = GF(9) sage: for i in [0..8]: print k(i) : 0 1 2 0 1 2 0

[sage-support] Re: Polynomial over a finite field using integer coefficients

2009-09-22 Thread Simon King
Hi Shing! Two possibilities: sage: k. = GF(9) sage: t=a^2+1 Now, you can learn about all possible methods for elements of k by doing sage: t. (you type t, dot, and hit the tab key). This will show you a list of possible methods. One of the methods is called int_repr: sage: t.int_repr()

[sage-support] Re: Polynomial

2009-07-15 Thread Burcin Erocal
On Wed, 15 Jul 2009 11:29:37 -0700 William Stein wrote: > > On Wed, Jul 15, 2009 at 11:23 AM, Martin > Albrecht wrote: > > > >> That's not surprising given what power_mod does.  Do power_mod?? to > >> see.  It's generic code that does the arithmetic in the parent > >> ring, then calls mod after

[sage-support] Re: Polynomial

2009-07-15 Thread William Stein
On Wed, Jul 15, 2009 at 11:23 AM, Martin Albrecht wrote: > >> That's not surprising given what power_mod does.  Do power_mod?? to >> see.  It's generic code that does the arithmetic in the parent ring, >> then calls mod after each multiply.   so in the above first example, >> zmod_poly is never us

[sage-support] Re: Polynomial

2009-07-15 Thread Martin Albrecht
> That's not surprising given what power_mod does. Do power_mod?? to > see. It's generic code that does the arithmetic in the parent ring, > then calls mod after each multiply. so in the above first example, > zmod_poly is never used. This reminds me: Why do we have power_mod() when pow() doe

[sage-support] Re: Polynomial

2009-07-15 Thread William Stein
On Wed, Jul 15, 2009 at 5:03 AM, Martin Albrecht wrote: > >> For the ring of polynomials with coefficients over ZZ: >> >> -- >> >> | Sage Version 4.1, Release Date: 2009-07-09                         | >> | Type notebook() for the

[sage-support] Re: Polynomial

2009-07-15 Thread Martin Albrecht
> For the ring of polynomials with coefficients over ZZ: > > -- > > | Sage Version 4.1, Release Date: 2009-07-09 | > | Type notebook() for the GUI, and license() for information.| > > --

[sage-support] Re: Polynomial

2009-07-15 Thread Harald Schilly
On Jul 15, 1:46 pm, Santanu Sarkar wrote: > Suppose  f=2*x^2+3*x+1 is a polynomial in x. How efficiently we > can calculate f^10 modulo 24? quite fast i think: sage: R. = PolynomialRing(Integers(24), x) sage: R Univariate Polynomial Ring in x over Ring of integers modulo 24 sage: f = 2*x^2+3*x

[sage-support] Re: Polynomial

2009-07-15 Thread Martin Albrecht
On Wednesday 15 July 2009, Santanu Sarkar wrote: > Suppose f=2*x^2+3*x+1 is a polynomial in x. How efficiently we > can calculate f^10 modulo 24? sage: P. = PolynomialRing(Zmod(24)) sage: f = 2*x^2+3*x+1 sage: type(f) sage: %timeit f**10 10 loops, best of 3: 19 µs per loop

[sage-support] Re: Polynomial

2009-07-15 Thread Minh Nguyen
Hi Santanu, On Wed, Jul 15, 2009 at 9:46 PM, Santanu Sarkar wrote: > Suppose f=2*x^2+3*x+1 is a polynomial in x. How efficiently we > can calculate f^10 modulo 24? For the ring of polynomials with coefficients over ZZ: -- | Sa

[sage-support] Re: polynomial coercion bug?

2009-02-24 Thread Alex Raichev
Thanks for your clarification and help, Carl. Alex On Feb 24, 5:15 pm, Carl Witty wrote: > On Feb 23, 7:57 pm, Carl Witty wrote: > > > On Feb 23, 6:54 pm, Alex Raichev wrote: > > > > Carl, regarding the parenthetical remark of your first reply, are you > > > saying the coercion error for plai

[sage-support] Re: polynomial coercion bug?

2009-02-23 Thread Carl Witty
On Feb 23, 7:57 pm, Carl Witty wrote: > On Feb 23, 6:54 pm, Alex Raichev wrote: > > > Carl, regarding the parenthetical remark of your first reply, are you > > saying the coercion error for plain old monomials below is supposed to > > happen? > > Well, I wouldn't say "supposed to happen" because

[sage-support] Re: polynomial coercion bug?

2009-02-23 Thread Carl Witty
On Feb 23, 6:54 pm, Alex Raichev wrote: > Carl, regarding the parenthetical remark of your first reply, are you > saying the coercion error for plain old monomials below is supposed to > happen? Well, I wouldn't say "supposed to happen" because I don't think this is the way it should stay long-t

[sage-support] Re: polynomial coercion bug?

2009-02-23 Thread Alex Raichev
Carl, regarding the parenthetical remark of your first reply, are you saying the coercion error for plain old monomials below is supposed to happen? If so, then what's the simplest way to take an element f of a polynomial ring R over a number field F and compute its embedded image in RR= R.change

[sage-support] Re: polynomial coercion bug?

2009-02-20 Thread Alex Raichev
Sweet! Thanks, Carl. Alex On Feb 20, 8:08 pm, Carl Witty wrote: > On Feb 19, 10:16 pm, Carl Witty wrote: > > > There's a bug.  And, now that you've pointed out the bug, I figured > > out how to crash Sage with a segmentation fault; so it's a serious > > bug.  Thanks for reporting it!  This bu

[sage-support] Re: polynomial coercion bug?

2009-02-19 Thread Carl Witty
On Feb 19, 10:16 pm, Carl Witty wrote: > There's a bug.  And, now that you've pointed out the bug, I figured > out how to crash Sage with a segmentation fault; so it's a serious > bug.  Thanks for reporting it!  This bug is now being tracked at > http://trac.sagemath.org/sage_trac/ticket/5316 OK

[sage-support] Re: polynomial coercion bug?

2009-02-19 Thread Carl Witty
On Feb 19, 7:59 pm, Alex Raichev wrote: > Hi all: > > I get an error when i try to coerce monomials of a multivariate > polynomial ring over a number field to the corresponding polynomial > ring over QQbar.  Shouldn't this work?  They're monomials; no > coefficients.  Here's an example. > > Alex

[sage-support] Re: Polynomial Problem

2009-01-21 Thread Jason Grout
Robert Bradshaw wrote: > On Dec 29, 2008, at 4:47 PM, William Stein wrote: > >> On Mon, Dec 29, 2008 at 4:34 PM, Robert Bradshaw >> wrote: >>> +1 to (deprecating then removing) removing X.list(), and replacing it >>> with X.entries(). >> Very good point. We *must* remember to make X.list() use

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Robert Bradshaw
On Dec 29, 2008, at 4:47 PM, William Stein wrote: > > On Mon, Dec 29, 2008 at 4:34 PM, Robert Bradshaw > wrote: >> >> +1 to (deprecating then removing) removing X.list(), and replacing it >> with X.entries(). > > Very good point. We *must* remember to make X.list() use the > deprecation warning

[sage-support] Re: Polynomial Problem

2008-12-29 Thread William Stein
On Mon, Dec 29, 2008 at 4:34 PM, Robert Bradshaw wrote: > > +1 to (deprecating then removing) removing X.list(), and replacing it > with X.entries(). Very good point. We *must* remember to make X.list() use the deprecation warning system, and only remove it after 6 months. Could you make a tra

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Robert Bradshaw
On Dec 29, 2008, at 4:15 PM, William Stein wrote: > On Mon, Dec 29, 2008 at 2:43 PM, Justin Walker wrote: >> >> On Dec 29, 2008, at 5:23 PM, John Cremona wrote: >> >>> >>> Maybe I missed the point here but after >> >> The point was a minor one... >> >>> R.=QQ[] >>> M=matrix(R,1,2,[x1+x2,x1*x2])

[sage-support] Re: Polynomial Problem

2008-12-29 Thread William Stein
On Mon, Dec 29, 2008 at 2:43 PM, Justin Walker wrote: > > > On Dec 29, 2008, at 5:23 PM, John Cremona wrote: > >> >> Maybe I missed the point here but after > > The point was a minor one... > >> R.=QQ[] >> M=matrix(R,1,2,[x1+x2,x1*x2]) >> >> you can get at the entries like this: >> sage: M[0,0] >

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Justin Walker
On Dec 29, 2008, at 5:23 PM, John Cremona wrote: > > Maybe I missed the point here but after The point was a minor one... > R.=QQ[] > M=matrix(R,1,2,[x1+x2,x1*x2]) > > you can get at the entries like this: > sage: M[0,0] > x1 + x2 > sage: M[0,1] > x1*x2 For the OP, it was surprising that "lis

[sage-support] Re: Polynomial Problem

2008-12-29 Thread John Cremona
Maybe I missed the point here but after R.=QQ[] M=matrix(R,1,2,[x1+x2,x1*x2]) you can get at the entries like this: sage: M[0,0] x1 + x2 sage: M[0,1] x1*x2 where the only non-obvious thing to a mathematician is that the row/col indices start at at 0. The list() discussion seems separate to me.

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Justin Walker
On Dec 29, 2008, at 4:53 PM, Robert Bradshaw wrote: > > On Dec 29, 2008, at 1:38 PM, Justin Walker wrote: > >> On Dec 29, 2008, at 3:32 PM, Santanu Sarkar wrote: >> >>> I write a program in SAGE as follows: >>> R.=QQ[] >>> M=matrix(R,1,2,[x1+x2,x1*x2]) >>> may i do following steps to extract poly

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Robert Bradshaw
On Dec 29, 2008, at 1:38 PM, Justin Walker wrote: > On Dec 29, 2008, at 3:32 PM, Santanu Sarkar wrote: > >> I write a program in SAGE as follows: >> R.=QQ[] >> M=matrix(R,1,2,[x1+x2,x1*x2]) >> may i do following steps to extract polynomials from matrix? >> 1) x = list(M) >> 2) f1 = x[0] >> 3) f2

[sage-support] Re: Polynomial Problem

2008-12-29 Thread Justin Walker
On Dec 29, 2008, at 3:32 PM, Santanu Sarkar wrote: > I write a program in SAGE as follows: > R.=QQ[] > M=matrix(R,1,2,[x1+x2,x1*x2]) > may i do following steps to extract polynomials from matrix? > 1) x = list(M) > 2) f1 = x[0] > 3) f2 = x[1] > is f1 & f2 are polynomials? > if not how i can get

[sage-support] Re: polynomial object and symoblic computations

2008-03-25 Thread Carl Witty
On Mar 25, 2:18 am, continuum121 <[EMAIL PROTECTED]> wrote: > Hi! > > I have a problem. Here is its formulation. I work in some polynomial > ring - lets say > R,(x,y) = PolynomialRing(QQ, 2, 'xy', order='lex').objgens() > and consider ideal in R > I = ideal(x+y^3-2,y+x^3-2) > then I calculate grob

[sage-support] Re: polynomial object and symoblic computations

2008-03-25 Thread Marshall Hampton
If getting numerical roots is sufficient, then you might want to check out the optional phcpack package. I am working on a more full- featured interface for sage-2.11 that classifies roots of multivariable polynomial systems. Phcpack is be able to compute roots for systems where Groebner bases

[sage-support] Re: polynomial object and symoblic computations

2008-03-25 Thread David Joyner
It might work if you try coercing f = B[0] first into R2. = PolynomialRing(CC, 2, 'xy') then applying factor or whatever to R2(f). I haven't tried it with your problem but that general idea has worked for me in similar situations. On Tue, Mar 25, 2008 at 5:18 AM, continuum121 <[EMAIL PROTECTED

[sage-support] Re: Polynomial Ring over a Fraction Field

2008-02-13 Thread Simon King
Dear Sage team, sorry, i have a follow up question: sage: F=FractionField(PolynomialRing(QQ,'A')) sage: R=PolynomialRing(F,'x0,x1,x2,x3') sage: x0=R.gen(0);x1=R.gen(1);x2=R.gen(2);x3=R.gen(3) sage: A=F('A') sage: I=R.ideal((-1)*x0^2 + (-1)*x1*x2 + 1, (-1)*x0*x2 + (-1)*x2*x3, (-1)*x0*x1 + (-1)*x1

[sage-support] Re: Polynomial Ring over a Fraction Field

2008-02-13 Thread Simon King
Dear John, On Feb 13, 1:17 pm, "John Cremona" <[EMAIL PROTECTED]> wrote: > I would say > F=FractionField(PolynomialRing(QQ,'A')) > A-F.gen() > and then > 1/A > F(1/A) > are all fine. My main question was how to do 1/A in a polynomial ring over F (not over F itself), but in fact your suggestion w

[sage-support] Re: Polynomial Ring over a Fraction Field

2008-02-13 Thread John Cremona
Your problem is too many quotes! You are giving strings to F(). I would say F=FractionField(PolynomialRing(QQ,'A')) A-F.gen() and then 1/A F(1/A) are all fine. John On 13/02/2008, Simon King <[EMAIL PROTECTED]> wrote: > > Dear Sage team, > > i tried the following: > sage: F=FractionField(Po

[sage-support] Re: polynomial substitution

2008-01-01 Thread William Stein
On Jan 1, 2008 1:31 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > After executing the following commands in Sage: > > QQi.=QQ.extension([x^2+1]); > R.=MPolynomialRing(QQi,order='lex') > T1_Pxxx=3*a^2*b+(1-a)^2*(1-b)-f0 > T1_Pxxy=3*(1-a)^2*b+3*a^2*(1-b)+6*a^2*b-f2 > T1_Pxyz=6*(1-a)*a*b+6*a*(

[sage-support] Re: polynomial evaluation

2007-03-08 Thread William Stein
On 3/8/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > > That said, I would love to add a function that basically does the above > > to SAGE, but it's unclear what the notation would even be. One idea > > is this: > >sage: f(w=3) > > in my actual situation, i have something like > > R1. = QQ

[sage-support] Re: polynomial evaluation

2007-03-08 Thread Kyle Schalm
> > The above code is a good idea, but there would be efficiency > issues. It would be better to do this (see the ev function below). > > sage: R1. = QQ['w'] > sage: R2. = R1['z'] > sage: f = w*z + (1-w)*z^3 + 3 > sage: def ev(f, a): > ...return f.parent()([c(a) for c in f.list()]) > sage: e

[sage-support] Re: polynomial evaluation

2007-03-08 Thread William Stein
On 3/7/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > > On 3/7/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > >> . the question is: how do i evaluate w while leaving z untouched? > >> (i actually want to do this when R1 is a multivariable ring, but i imagine > >> it works the same way.) > >> > > > > C

[sage-support] Re: polynomial evaluation

2007-03-07 Thread Kyle Schalm
> > On 3/7/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > >> . the question is: how do i evaluate w while leaving z untouched? >> (i actually want to do this when R1 is a multivariable ring, but i imagine >> it works the same way.) >> > > Can't you just work with all the variables together, like:

[sage-support] Re: polynomial evaluation

2007-03-07 Thread Luis Finotti
On 3/7/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > . the question is: how do i evaluate w while leaving z untouched? > (i actually want to do this when R1 is a multivariable ring, but i imagine > it works the same way.) > Can't you just work with all the variables together, like: sage: P.=QQ['