Ask Your Question

andriam's profile - activity

2023-12-03 08:30:07 +0200 received badge  Famous Question (source)
2023-05-08 22:04:36 +0200 received badge  Popular Question (source)
2023-05-06 18:36:18 +0200 commented question which version of Sage support the construction of algebraic-geometry codes ?

Thank you tolga !

2023-05-06 18:25:26 +0200 commented answer how to create an elliptic curve in sage

Many thanks to achrzesz; now its works !

2023-05-06 09:44:49 +0200 asked a question how to create an elliptic curve in sage

how to create an elliptic curve in sage the following code from sage.schemes.elliptic_curves import EllipticCurve E =

2023-05-06 09:44:47 +0200 asked a question how to create an elliptic curve in sage

how to create an elliptic curve in sage the following code from sage.schemes.elliptic_curves import EllipticCurve E =

2023-04-22 11:47:35 +0200 edited question which version of Sage support the construction of algebraic-geometry codes ?

which version of Sage support the construction of algebraic-geometry codes ? I've installed Sage version 9.5 but it prod

2023-04-22 11:47:16 +0200 edited question which version of Sage support the construction of algebraic-geometry codes ?

which version of Sage support the construction of algebraic-geometry codes ? I've installed Sage version 9.3 but it prod

2023-04-22 11:46:57 +0200 edited question which version of Sage support the construction of algebraic-geometry codes ?

which version of Sage support the construction of algebraic-geometry codes ? I've installed Sage version 9.5 but it prod

2023-04-22 10:58:41 +0200 asked a question which version of Sage support the construction of algebraic-geometry codes ?

which version of Sage support the construction of algebraic-geometry codes ? I've installed Sage version 9.3 but it prod

2023-04-22 10:58:37 +0200 asked a question which version of Sage support the construction of algebraic-geometry codes ?

which version of Sage support the construction of algebraic-geometry codes ? I've installed Sage version 9.3 but it prod

2022-10-30 14:31:24 +0200 received badge  Famous Question (source)
2022-10-30 14:31:24 +0200 received badge  Notable Question (source)
2021-11-27 22:27:19 +0200 received badge  Popular Question (source)
2021-11-27 22:27:19 +0200 received badge  Notable Question (source)
2021-11-27 21:32:55 +0200 received badge  Notable Question (source)
2021-05-04 16:25:48 +0200 received badge  Popular Question (source)
2020-08-25 02:47:36 +0200 received badge  Popular Question (source)
2020-08-14 13:04:20 +0200 received badge  Nice Question (source)
2020-08-13 20:45:18 +0200 asked a question In Sage Notebook, does sage compile all programs in a cell ?

Sometimes, in Sagenotebook, when I put many programs in the same cell, for example, the definition of a class, methods within this class and functions , it seems that Sage compiles the class defintions and methods, but ignores the functions.

2020-08-13 15:13:18 +0200 marked best answer does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?

I define the following rings and ideals:

sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3

sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3

sage: I = ideal(X^2 - 1, Y^2 - 1, Z^2 - 1); I
Ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3

sage: R = A.quotient_ring(I); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)

sage: x, y, z = R.gens()

sage: J = ideal(x*y + z, x + x*z, x*z + y); J
Ideal (Xbar*Ybar + Zbar, Xbar*Zbar + Xbar, Xbar*Zbar + Ybar)
of Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)

I then compute:

sage: B = J.groebner_basis()

and examine the result of that computation:

sage: B
[Xbar + 2*Ybar, Zbar + 1]

Is it really the Groebner basis of J?

Did Sage really compute in A/I and not in A?

2020-08-13 15:12:03 +0200 marked best answer how to delete all programs, inputs and output in the sage console ?

I've tried all commands I know : reset(), !clear, %clear i, -ipython history clear, ipython history trim, --ipython locate profile default to clear history in my sage console but all of these do not work ,

,

2020-08-13 15:11:00 +0200 marked best answer may an object in sage lose its type in a method within a class ?

Many thanks to @slelievre for his response and to @tmonteil for his comments. Here is the original Sage code. It and a little bit long but perhaps all these are useful to see what goes wrong:

class CCODEPARAM:
    def __init__(self, liste_ent, prem, em):
        self.liste_ent = liste_ent
        self.prem = prem
        self.em = em

    def qu(CyclicCodeParam):
        q = (CyclicCodeParam.prem)^(CyclicCodeParam.em)
        return q

    def long(CyclicCodeParam):
        NN = CyclicCodeParam.liste_ent
        r = len(NN)
        n = 1
        for i in range(r):
            n = n * NN[i]
        return n

    def epsilon(CyclicCodeParam):
        NN = CyclicCodeParam.liste_ent
        from sage.arith.functions import LCM_list
        eps = LCM_list(NN)
        return eps

    def t(CyclicCodeParam):
        NN = CyclicCodeParam.liste_ent
        p = CyclicCodeParam.prem
        r = len(NN)
        m = CyclicCodeParam.em
        q = p^m
        eps = CyclicCodeParam.epsilon()
        k = 1
        while not(mod(q^k-1, eps) == 0):
            k += 1
        return k

    def cardn(CyclicCodeParam):
        return (CyclicCodeParam.qu())^(CyclicCodeParam.long())

    def Gqu(CyclicCodeParam):
        Q = (CyclicCodeParam.qu())^(CyclicCodeParam.t())
        return Q

    def liste_groupes(CyclicCodeParam):
        NN = CyclicCodeParam.liste_ent
        r = len(NN)
        Groupes = []
        for i in range(r):
            Groupes.append(Set(IntegerModRing(NN[i])))
        return Groupes

    def prod_groupes(CyclicCodeParam):
        GR = CyclicCodeParam.liste_groupes()
        GG = list(cartesian_product(tuple(GR)))
        return GG

    def corps(CyclicCodeParam):
        F = GF((CyclicCodeParam.qu()))
        FF = GF(CyclicCodeParam.Gqu())
        return [F, FF]

    def prim(CyclicCodeParam):
        K = CyclicCodeParam.corps()
        L = K[1]
        a = L.multiplicative_generator()
        return a

    def primorderb(CyclicCodeParam):
        Q = CyclicCodeParam.Gqu()
        eps = CyclicCodeParam.epsilon()
        a = CyclicCodeParam.prim()
        b = a^((Q - 1) / eps)
        return b

    def primuroots(CyclicCodeParam):
        NN = CyclicCodeParam.liste_ent
        r = len(NN)
        eps = CyclicCodeParam.epsilon()
        b = CyclicCodeParam.primorderb()
        e = []
        for i in range(r):
            e.append(b^(eps/NN[i]))
        return e

    def galois(CyclicCodeParam):
        t = CyclicCodeParam.t()
        q = CyclicCodeParam.qu()
        MM = list(Set({q^nu for nu in range(t)}))
        return MM

    def orbites(CyclicCodeParam):
        GG = CyclicCodeParam.prod_groupes()
        MM = CyclicCodeParam.galois()
        NN = CyclicCodeParam.liste_ent
        O = orb(GG, MM, NN)
        return O

    def ambspace(CyclicCodeParam):
        F = CyclicCodeParam.corps()[0]
        n = CyclicCodeParam.long()
        K = list(cartesian_product([F]*n))
        return K

    def zeros(PAR, A):
        O = PAR.orbites()
        Z = Set({O[i][0] for i in A})
        return Z

    def CCODE(PAR, A, Vars):
        # order = 'lex'
        CORPS = PAR.ambspace()
        print type(CORPS)
        Z = PAR.zeros(A)
        # print Z
        Exp = PAR.orbites()
        # print Exp
        e = PAR.epsilon()
        print e
        CODE = {Zvalpol2(c, Vars, Exp, e, Z) for c in CORPS}
        return CODE

def oneorb(g, MM, NN):
    O = Set({})
    r = len(NN)
    for u in MM:
        B = []
        for i in range(r):
            B.append(mod((g[i])*u,NN[i]))
        O = O.union(Set({tuple(B)}))
    return O

def orb(GG, MM, NN):
    Orb = Set({})
    GG = Set(GG)
    for g in GG:
        t = oneorb(g,MM,NN)
        Orb = Orb.union(Set({t}))
        GG = GG.difference(Orb)
    return Orb

def pol(c, Vars, Exp):
    n = len(c)
    m = len(Vars)
    P = 0
    M = []
    for i in range(n):
        M.append(0)
    M = list(M)
    for i in range(n):
        M[i] = 1
        for j in range(m):
            M[i] *= Vars[j]**Exp[i][j]
    for i in range(n):
            P += c[i] * M[i]
    return P

def Zvalpol2(c, Vars, Exp, e, Z):
    P = pol(c, Vars, Exp)
    print('poly')
    r = len(Vars)
    V = Set({})
    for h in Z:
        E = []
        for i in range(r):
            E.append(e[i]**h[i])
        V = V + Set({P(tuple(E))})
        if V == Set({0}):
            mes2 = 'mot de code'
            print mes2

In the fonction "CCODE", when constructing the objet "CORPS" by CORPS =PAR.ambspace(), Sage return "none" for its type, even though the fonction "ambspace" return the object "K", which is of type "list". As a consequence, when executing the function CCODE, Sage returns an error by saying that objet of nonetype (which is CORPS) is not iterable. This happens on the instruction above the "return CODE" in the function CCODE.

2020-08-13 15:10:15 +0200 marked best answer how to evaluate a polynomial in a quotient ring ?

I define a polynomial ring and its quotient by an ideal:

sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3
sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1)); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)

I define an element in this quotient ring:

sage: f = x*y*z; f
x*y*z
sage: f.parent()
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)

I want to evaluate this element at $(x, y, z) = (2, 3, 4)$.

I tried this, and got this error message:

sage: f(2, 3, 4)
Traceback (most recent call last)
...
TypeError: 'QuotientRing_generic_with_category.element_class' object is not callable

How can I calculate f(2, 3, 4) with Sage?

2020-08-13 15:09:27 +0200 marked best answer how to get the coefficient of a multivariate polynomial with respect to a specific variable and degree, in a quotient ring ?

Here is what I tried.

sage: F = ZZ.quo(3*ZZ); F
sage: A.<X, Y, Z> = PolynomialRing(F); A
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1))
sage: f = x*z + x*y*z + y + 1
sage: f.coefficient(z, 1)
sage: f.coefficient({z: 1})
sage: f.coeffcient(z)
2020-08-13 15:06:54 +0200 received badge  Supporter (source)
2020-08-13 15:06:32 +0200 marked best answer How to make Sage know that a set is an ideal

I have constructed the following ideal

J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}

in the ring

$$ R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1) $$

where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$) modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its construction, the set $J$ is indeed an ideal, containing 2187 elements, so it is hard to write or copy all its elements. I want to find a Groebner basis of $J$, by writing

B = J.groebner_basis(),

but Sage returns

TypeError: R must be a commutative ring.

This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!

I must first construct the ideal

H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)

and then compute

B = H.groebner_basis().

That works, but, as I previously said, it is not easy to construct the ideal $H$ because that needs copy and paste 2187 elements!

Therefore I'd like to know whether there is another way to the task, without copying and pasting all of the elements of $J$, and declaring the ideal of these elements, is there a way to convert a set of elements in a ring (which is already an ideal) to the underlying ideal?

2020-08-13 15:06:32 +0200 received badge  Scholar (source)
2020-08-13 10:55:15 +0200 commented question How to make Sage know that a set is an ideal

Strangely, when I write the Sage programs in the text editor of Asksage, the line containing "def" (for example def vect2pol(c,Vars in the preceeding code) is outside of the box containing the remaining part of the program. Can you explain how to correct it ?

2020-08-13 10:45:33 +0200 commented answer How to make Sage know that a set is an ideal

Strangely, the method groebner_basis() works for an ideal in the quotient ring R (see the above example, in the comments in response to slelievre). Perhaps, as you have said, Sage use the lift() method to compute a Gröbner basis in $F3[X,Y,Z]$ and the returned to $R$. I was confused when I first used this for ideals in quotient ring, this is why I asked the question "Does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?

2020-08-13 10:41:10 +0200 commented question How to make Sage know that a set is an ideal

The set $J$ is then those of the polynomials of $R$ which vanishes on ${(1,2,1)}$ (It may be not be equal to the initial $J$ in my question), but that doesn't matter, it also contains 2187 elements). Using the command nbruin gave below, I entered

J1=ideal(*J);J1

B=J1.groebner_basis();B

and Sage returned

[x - 1, y + 1, z - 1].

The problem is solved : $J1$ is the ideal whose elements are the same as those of $J$ and no copy and paste were needeed!