Ask Your Question

Sylvain's profile - activity

2023-11-05 13:45:08 +0200 received badge  Necromancer (source)
2023-11-05 11:53:48 +0200 edited answer Pulling the index of an entry of a matrix

Matrix type has a find method which allows that: sage: deg.find(lambda entry:entry==15,indices=True) {(5, 2): 15, (5, 4

2023-11-05 11:53:30 +0200 edited answer Pulling the index of an entry of a matrix

Matrix type has a find method which allows that: sage: deg.find(lambda entry:entry==15,indices=True) {(5, 2): 15, (5, 4

2023-11-05 11:53:11 +0200 answered a question Pulling the index of an entry of a matrix

Matrix type has a find method which allows that: sage: deg.find(lambda entry:entry==15,indices=True) {(5, 2): 15, (5, 4

2023-04-26 22:23:06 +0200 answered a question I try to calculate by using discrete_log() but not work for large number

The current record for prime number modulus discrete logarithm is about 795 bits using about 3100 core-years. You are tr

2022-09-02 10:41:48 +0200 answered a question Inner products with dimension $n$.

You may use symbolic variables and interpret the * operator as the inner poduct: sage: u,v,r = var("u v r") sage: (u*(v

2022-07-30 11:05:43 +0200 edited answer Discrete logarithm problem for multiplicative groups

The function log of Finite rings calls directly the function znlog of Pari. According to the documentation, znlog uses f

2022-07-30 11:04:08 +0200 edited answer Discrete logarithm problem for multiplicative groups

The function log of Finite rings calls directly the function znlog of Pari. According to the documentation, znlog uses f

2022-07-30 10:53:09 +0200 received badge  Popular Question (source)
2022-07-30 10:41:31 +0200 edited answer Discrete logarithm problem for multiplicative groups

The function log of Finite rings calls directly the function znlog of Pari. According to the documentation, znlog uses f

2022-07-30 10:40:42 +0200 edited answer Discrete logarithm problem for multiplicative groups

The function log of Finite rings calls directly the function znlog of Pari. According to the documentation, znlog uses f

2022-07-30 10:31:53 +0200 answered a question Discrete logarithm problem for multiplicative groups

The function log of Finite rings calls directly the function znlog of Pari. According to the documentation, znlog uses f

2022-03-10 08:22:21 +0200 received badge  Supporter (source)
2020-12-18 03:39:43 +0200 received badge  Nice Answer (source)
2020-12-12 17:54:11 +0200 received badge  Editor (source)
2020-12-10 16:29:03 +0200 answered a question Is there a shortcut command to iterate an endomorphism?

You can define a function that takes a function f and an integer n, and returns the n-th iterate of f.

This can be done using def and lambda:

sage: def iterate(f, n):
....:     r"""
....:     Return the n-th iterate of ``f``.
....:     """
....:     if n not in NN:
....:         raise ValueError("can only define n-th iterate for n in NN")
....:     return lambda x: x if n == 0 else iterate(f, n-1)(f(x))

or using nested lambdas:

sage: iterate = lambda f, n: lambda x: x if n == 0 else iterate(f, n-1)(f(x))

Then, given a function, for instance:

sage: def square(x):
....:     return x**2

you can define its iterate:

sage: f = iterate(square, 4)
sage: f
<function ...>

and compute with it:

sage: f(x)
x^16

or directly:

sage: iterate(square, 4)(x)
x^16
2020-11-21 17:34:40 +0200 received badge  Scholar (source)
2020-11-20 23:55:02 +0200 received badge  Teacher (source)
2020-11-20 23:55:02 +0200 received badge  Necromancer (source)
2020-11-20 23:52:18 +0200 received badge  Student (source)
2020-11-20 21:44:23 +0200 asked a question Error generating finite field

I have the following error while creating finite fields:

sage: F1.<x> = GF(2**8, modulus=x^8 + x^6 + x^5 + x^4 + x^3 + x + 1)
sage: F2.<x> = GF(2**8, modulus=x^8 + x^4 + x^3 + x^2 + 1)
ValueError                                Traceback (most recent call last)
<ipython-input-2-bb7f80049a89> in <module>
----> 1 F2 = GF(Integer(2)**Integer(8), modulus=x**Integer(8) + x**Integer(4) + x**Integer(3) + x**Integer(2) + Integer(1),   

    names=('x',)); (x,) = F2._first_ngens(1)

~/software/sage/local/lib/python3.8/site-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:2179)()
    365             False
    366         """
--> 367         key, kwds = self.create_key_and_extra_args(*args, **kwds)
    368         version = self.get_version(sage_version)
    369         return self.get_object(version, key, kwds)

~/software/sage/local/lib/python3.8/site-packages/sage/rings/finite_rings/finite_field_constructor.py in create_key_and_extra_args(self, order, name, modulus, names, impl, proof, check_irreducible, prefix, repr, elem_cache, **kwds)
    585 
    586                     if modulus.degree() != n:
--> 587                         raise ValueError("the degree of the modulus does not equal the degree of the field")
    588                     if check_irreducible and not modulus.is_irreducible():
    589                         raise ValueError("finite field modulus must be irreducible but it is not")

ValueError: the degree of the modulus does not equal the degree of the field

This is annoying when you attach a script, the error happens each time you change the file. It does not happen if the variable name is different that the variable used in the modulus expression. For example:

sage: F1.<a> = GF(2**8, modulus=x^8 + x^6 + x^5 + x^4 + x^3 + x + 1)
sage: F2.<b> = GF(2**8, modulus=x^8 + x^4 + x^3 + x^2 + 1)

Is there a reason for this behavior ?

2020-11-20 21:12:39 +0200 answered a question implicitly defining a sequence of variables

I use the following:

sage: x = SR.var("x", 10)
sage: sage: p = sum(a[i]*x^i for i in range(10)); p                                                  
a9*x^9 + a8*x^8 + a7*x^7 + a6*x^6 + a5*x^5 + a4*x^4 + a3*x^3 + a2*x^2 + a1*x + a0
2020-11-20 20:55:07 +0200 answered a question RSS feeds for questions

You have a button "subscribe to rss feed" on the right side of the question which do that.