Re: [sage-support] Polynomial comparison

2020-06-28 Thread Rob H.
I mean, I know about this, I guess it's just jarring to see it in action (especially when the truth of x > x-1 depends on how many variables your polynomial ring has). I feel like it goes against duck-typing. If I write code that I want to work as long as there's a well-defined notion of positi

Re: [sage-support] Polynomial comparison

2020-06-27 Thread Dima Pasechnik
On Sat, Jun 27, 2020 at 10:38 AM Rob H. wrote: > > > > Hi all, > > So I was surprised to find out that asking if a polynomial is > 0 doesn't > raise an error. many Sage objects compare in a totally non-mathematical way, just to be able to sort them. Polynomials are no exception. One day we migh

[sage-support] Polynomial comparison

2020-06-27 Thread Rob H.
Hi all, So I was surprised to find out that asking if a polynomial is > 0 doesn't raise an error. Now, maybe there's a good reason why it returns True and I'm too tired to think about why. At the very least, here is some disturbing behaviour. sage: R. = PolynomialRing(QQ) sage: x > x-1 True

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

2019-11-18 Thread Pedro Vinícius Ferreira Baptista
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 example, the coefficients of the polynomial of powers of A). Finally I want to find the dimension of the

Re: [sage-support] Polynomial over prime field

2019-06-17 Thread John Cremona
On Mon, 17 Jun 2019 at 13:02, chandra chowdhury wrote: > Hi, > I have multi variable polynomial over integers say f(x,y,z). > I want to define it over GF(5) efficiently. > > For that I am doing this: > > > R=PolynomialRing(GF(5), 3, 'X') > Z = list(R.gens()) > > But g=R(f(Z)) is not working. >

[sage-support] Polynomial over prime field

2019-06-17 Thread chandra chowdhury
Hi, I have multi variable polynomial over integers say f(x,y,z). I want to define it over GF(5) efficiently. For that I am doing this: R=PolynomialRing(GF(5), 3, 'X') Z = list(R.gens()) But g=R(f(Z)) is not working. -- You received this message because you are subscribed to the Google Group

[sage-support] Polynomial factorization over modular ring

2017-08-15 Thread chandra chowdhury
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 but the actual factorization is x*(x-1)*(x+1)*(x-7)*(x+7) -- You received this message because you are subscribed to the Google Groups "sage

[sage-support] Polynomial division without remainder

2014-03-24 Thread martin . vgagern
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 neither seems to work as I'd have hoped. See below for error messages. Example: sage

[sage-support] Polynomial rings and homogenization

2014-03-03 Thread Tristan
Hi all, I'm trying to use Sage to implement the number field sieve factorization algorithm, but I've reached a sticking point with defining polynomials and some of their in built functions. I'm running Sage-5.13 through VirtualBox 4.3.8 and homogenization does not work as expected. Following th

Re: [sage-support] Polynomial question.

2013-12-11 Thread Michael Orlitzky
On 12/11/2013 07:40 AM, Thierry Dumont wrote: > > Ok, this is correct, and seems nice; but I want to evaluate these > polynomials for different values of x, and you cannot evaluate a member > of "Integer Ring" at say, x=1/21... So I need to compute the parent of > polynomials (which possibly are

Re: [sage-support] Polynomial question.

2013-12-11 Thread John Cremona
I think that the constructor should return the same type for all values of i even when the result is a constant. It is all too easy to implement functions which behave as you show, when dealing with trivial simple cases: in this case it would be so easy to write at the start of the function "if i=

[sage-support] Polynomial question.

2013-12-11 Thread Thierry Dumont
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 at the parents sage: s[0].parent() Integer Ring s

[sage-support] Polynomial quotient and reminder

2013-04-17 Thread Andrea Lazzarotto
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. This is what I am trying to do: m = 4 k = 7 n = 2^m-1 f. = FiniteField(2^m); f r(x) = 1+alpha*x+alpha^2*x^2+x^3+x^4+x^5+x^6+x^7+x^8+alpha^3*x^

Re: [sage-support] Polynomial command

2013-04-04 Thread Neda Dargahi
* by the way ! On Thu, Apr 4, 2013 at 5:13 PM, Neda Dargahi wrote: > I asked this question befor but no one answerd so i think maybe if I know > how towrite F maybe I can solve this! > yes I read that page but still dont know how to write F > bye the way,thank you so much for answering. > > >

Re: [sage-support] Polynomial command

2013-04-04 Thread Neda Dargahi
I asked this question befor but no one answerd so i think maybe if I know how towrite F maybe I can solve this! yes I read that page but still dont know how to write F bye the way,thank you so much for answering. On Thu, Apr 4, 2013 at 5:05 PM, John Cremona wrote: > > > > > > On 4 April 2013 1

Re: [sage-support] Polynomial command

2013-04-04 Thread John Cremona
On 4 April 2013 13:27, Neda Dargahi wrote: > > no, ijust want to know how can I compute the remainder on division of > the given polynomial f by the order set F using grlex order in sage? thank > you f= x^*y^2+x^3*y^2-y+1 F=(x*y^2-x , x-y^3) > > I'm not sure how I was supposed to guess that fr

Re: [sage-support] Polynomial command

2013-04-04 Thread Neda Dargahi
no, ijust want to know how can I compute the remainder on division of the given polynomial f by the order set F using grlex order in sage? thank you f= x^*y^2+x^3*y^2-y+1 F=(x*y^2-x , x-y^3) On Thu, Apr 4, 2013 at 4:36 PM, John Cremona wrote: > Like this? > > sage: R. = QQ[] > sage: f = x^2+y

Re: [sage-support] Polynomial command

2013-04-04 Thread John Cremona
Like this? sage: R. = QQ[] sage: f = x^2+y^2 # for example sage: f(x^2-4,x^2-2*x) 2*x^4 - 4*x^3 - 4*x^2 + 16 John Cremona On 4 April 2013 12:58, Neda wrote: > > Hello > How can I write a polynomial f(x^2-4,x^2-2*x) in sage? > thank you > > -- > You received this message because you are

[sage-support] Polynomial command

2013-04-04 Thread Neda
Hello How can I write a polynomial f(x^2-4,x^2-2*x) in sage? thank you -- 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.co

Re: [sage-support] Polynomial equality etc.

2013-02-12 Thread John Cremona
This is rather simpler: you should be using polynomials and not the symbolic ring: sage: R. = QQ[] sage: f = x1*x2+x3*x4 sage: list({f(y) for y in permutations(R.gens())}) [x1*x2 + x3*x4, x2*x3 + x1*x4, x1*x3 + x2*x4] Someone has been implementing a module for classical invariant theory in Sage,

[sage-support] Polynomial equality etc.

2013-02-12 Thread Jori Mantysalo
Let's examine f(x1,x2,x3,x4)=x1*x2+x3*x4. It is D4-invariant. I was able to calculate that it has 3 possible outcomes out of 4!=24 arrangements of arguments: var('x1, x2, x3, x4') lista = [x1, x2, x3, x4] def f(y): return lista[y[0]]*lista[y[1]]+lista[y[2]]*lista[y[3]] list(set(map(f,

Re: [sage-support] Polynomial Ring

2013-01-23 Thread John Cremona
On 23 January 2013 17:43, Santanu Sarkar wrote: > R=Integers(30)['X'] > f1=X-10 > f2=X-30 > print f1*f2 Your code does not work at all since you never assign a value to X. This does work as expected: sage: R.=Integers(30)[] sage: f1=X-10 sage: f2=X-30 sage: print f1*f2 X^2 + 20*X John Cremona -

[sage-support] Polynomial Ring

2013-01-23 Thread Santanu Sarkar
I have written following code: R=Integers(30)['X'] f1=X-10 f2=X-30 print f1*f2 This gives X^2-40*X+300 However I want coefficients to be modulo 30 i.e., 40 =10 , 300=0 in R. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To post to this grou

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

2012-08-18 Thread Jori Mantysalo
Can Sage calculate for example sextic resolvent? I mean something similar than "P(x)=x^3+ax^2+bx+c and roots of P are x1, x2 and x3. Express (x1-x2)(x2-x3)(x1-x3) as a function of a, b and c." Some webpages says that Mathematica could make this with SymmetricReduce, but I can't test that just

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

2012-06-13 Thread Oleksandr Kazymyrov
Hi all, Continuing the question ... Input data: sage: K=GF(2^8,'a',modulus=ZZ['x']("x^8 + x^7 + x^6 + x^4 + x^3 + x^2 + 1")) sage: K.multiplicative_generator() a^4 + a^3 + a sage: P=PolynomialRing(K,'x') sage: pol=P.ran

[sage-support] Polynomial over GF(16)

2012-05-08 Thread ArturZ
Hi, I've one problem in the following task. My calculations: I'm defining following function: def custom_divide(x,y): if x==0: return 0 return y/x Next, I'm calculating all possible values over *GF(16)* for the function *T* : F.=GF(16) for a,b in F^2: pr

Re: [sage-support] polynomial division

2012-04-22 Thread Justin C. Walker
On Apr 22, 2012, at 13:23 , Michael Beeson wrote: > Sage version 4.6.1 (I know it's old, new one is downloading now, but I > don't think this is a version problem.) > Given: polynomial f in x with some letters for the coefficients, and > polynomial psi of lower degree in x with constant co

[sage-support] polynomial division

2012-04-22 Thread Michael Beeson
Sage version 4.6.1 (I know it's old, new one is downloading now, but I don't think this is a version problem.) Given: polynomial f in x with some letters for the coefficients, and polynomial psi of lower degree in x with constant coefficients. Wanted: remainder of f on division by psi as

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

2011-03-25 Thread Surendran Karippadath
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)) plots a smooth curve going through -1/3. It is clear it is evaluating f =1/(x-4). How? Why is not p

Re: [sage-support] polynomial interpolation

2010-12-24 Thread Martin Albrecht
On Friday 24 December 2010, 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. > > Does there a simple way to do this? sage: K = GF(32003) sag

[sage-support] polynomial interpolation

2010-12-24 Thread lainme
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. Does there a simple way to do this? -- To post to this group, send email to sage-support@googlegroups.com To unsub

[sage-support] Polynomial

2010-12-04 Thread Santanu Sarkar
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). Is there any easier method to do this in Sage? -- To post to this group, send email to sage-support@g

[sage-support] polynomial division by increasing powers

2010-11-16 Thread Johannes Huisman
Hello, 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. Thanks in advance, Johannes -- http://pageperso.uni

[sage-support] polynomial constructor from roots

2010-10-23 Thread andrew ewart
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 -- To post to this group, send email to sage-support@googlegroups.com

[sage-support] Polynomial mod

2010-04-28 Thread Michael Rybalkin
I faced with a problem with polynomial mod This is example from manual: mod? sage: R. = QQ['x']; sage: f = x^3 + x + 1 sage: f.mod(x + 1) Result is -1 But changing from field QQ to ring ZZ causes mod to do nothing: sage: R. = ZZ['x']; sage: f = x^3 + x + 1 sage: f.mod(x + 1) Result is x^3 + x + 1

[sage-support] Polynomial Independence

2010-04-25 Thread Santanu Sarkar
Hi, Suppose f1, f2,,f10 are polynomials over 20 variables over integers. How one can check weather they are linearly independent or not in Sage? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googl

Re: [sage-support] Polynomial printing convention

2010-02-11 Thread William Stein
On Thu, Feb 11, 2010 at 4:45 AM, Simon King wrote: > Hi! > > In Sage, polynomials are usually printed starting with the leading > term: >  sage: R. = ZZ[] >  sage: p = R.random_element() >  sage: p >  4*t^2 + 6*t + 1 > > But there are people who would (at least if the context is formal > power ser

[sage-support] Polynomial printing convention

2010-02-11 Thread Simon King
Hi! In Sage, polynomials are usually printed starting with the leading term: sage: R. = ZZ[] sage: p = R.random_element() sage: p 4*t^2 + 6*t + 1 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 thes

[sage-support] polynomial interpolation

2010-02-04 Thread Pablo Spiga
Hello everyone, I'm new to sage ;-) we have two disjoint sets S1,S2 of size 168 in a field of order 3^6=729. We are looking for a univariate polynomial over this field mapping S1 onto S2. Of course Lagrange interpolation gives a polynomial with degree 167. But there are many choices for such polyn

[sage-support] polynomial remainder

2010-01-03 Thread Michael Beeson
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 function. But I could not find the analog of that function

Re: [sage-support] Polynomial Prolem

2009-12-19 Thread Santanu Sarkar
Thanks. 2009/12/9 Martin Albrecht > On Wednesday 09 December 2009, Santanu Sarkar wrote: > > Dear all, > > Suppose I have polynomials over rational(Q) field although coefficients > > are integer. > > I want to transform these polynomials over some finite field say GF(7). > > Try: > > sage: R.

Re: [sage-support] Polynomial Prolem

2009-12-09 Thread Martin Albrecht
On Wednesday 09 December 2009, Santanu Sarkar wrote: > Dear all, > Suppose I have polynomials over rational(Q) field although coefficients > are integer. > I want to transform these polynomials over some finite field say GF(7). Try: sage: R.=QQ[] sage: f1=2*x-3*y-1 sage: f2=x^2+y^2-5 sa

[sage-support] Polynomial Prolem

2009-12-09 Thread Santanu Sarkar
Dear all, Suppose I have polynomials over rational(Q) field although coefficients are integer. I want to transform these polynomials over some finite field say GF(7). I write the following program which does not work. R.=QQ[] f1=2*x-3*y-1 f2=x^2+y^2-5 R.=ZZ[] f3=f1(x1,y1) f4=f2(x1,y1) R.=GF(7)[] f

[sage-support] Polynomial approximation of a function

2009-11-02 Thread Nathann Cohen
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 Sage, but found none... Does it mean there is not already in Sage som

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

2009-09-22 Thread Shing Hing Man
Conside the finite field F=GF(9),say, and the polynomial ring F[x]. The elements of F are listed below. sage: k. = GF(9) sage: for x in k:print x 0 2*a a + 1 a + 2 2 a 2*a + 2 2*a + 1 1 sage: R = PolynomialRing(k,'x') sage: sage: x = R.0 We can think of elements of k as integers from 0 to

[sage-support] Polynomial

2009-07-15 Thread Santanu Sarkar
Suppose f=2*x^2+3*x+1 is a polynomial in x. How efficiently we can calculate f^10 modulo 24? --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroup

[sage-support] polynomial coercion bug?

2009-02-19 Thread Alex Raichev
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] Polynomial Problem

2008-12-29 Thread Santanu Sarkar
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 them? please help me! --~--~-~--~~~---~--~-

[sage-support] polynomial object and symoblic computations

2008-03-25 Thread continuum121
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 grobner basis for ideal I B = I.groebner_basis(); B B[0] is univariate polynomi

[sage-support] Polynomial Ring over a Fraction Field

2008-02-13 Thread Simon King
Dear Sage team, i tried the following: sage: F=FractionField(PolynomialRing(QQ,'A')) sage: A=F('A') sage: 1/A 1/A sage: F('1/A') 0 // not nice, but acceptable sage: R=PolynomialRing(FractionField(PolynomialRing(QQ,'A')),'x') sage: A=R('A') sage: 1/A Exception exceptions.RuntimeError: 'maximum re

[sage-support] polynomial substitution

2008-01-01 Thread [EMAIL PROTECTED]
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*(1-a)*b+6*a^2*(1-b)+6*a^2*b-f1 T1_Pyxx=3*(1-a)*a*b+3*a*(1-a)*(1-b)+6*a^2*b-(1-f0-f1-f

[sage-support] polynomial evaluation

2007-03-07 Thread Kyle Schalm
i have a question about a polynomial ring over a polynomial ring. suppose i have R1. = QQ['w'] R2. = R1['z'] and i construct some sort of element, f = z*w i know that if i want to evaluate z, i can do something like f(1) # output: w and even f(1)(5) # same as w(5) . the question is: