Ask Your Question

vukov's profile - activity

2022-11-02 18:23:30 +0200 marked best answer Computing ratio of two elements in a large ring

I have a ring (a matroid Chow ring) which has a large number of generators. It's structure is well-understood: it's graded, and the top degree is isomorphic to Q via a specific map, called the degree map. I know an explicit element whose image under the degree map is 1, call it a^{r-1}.

I have another element x of the matroid Chow ring, and I would like to compute it's degree. I can do that by computing x/a^{r-1}, but that is very slow (it seems to require a Grobner basis computation which does not finish on my computer).

When I ask sage to output x and a^{r-1}, sage outputs them as constant multiples of the same monomial. So from the output it is easy to read off what the degree is (look at the ratio of the monomials), but I would like to get it an automated way.

Example:

M = matroids.Uniform(4, 8)
A = M.chow_ring(QQ)
def flatToChow(F):
    s = 'A'
    for i in F:
        s = s + str(i)
    return A(s)

beta = A(0)
for i in range(1, M.rank()):
    for F in M.flats(i):
        if (0 not in F):
            beta = beta + flatToChow(F)
a = A(0)
for i in range(1, M.rank()):
    for F in M.flats(i):
        if (0 in F):
            a = a + flatToChow(F)
 x = beta^3
 x/a^3 #long time
2022-11-02 00:58:58 +0200 asked a question Computing ratio of two elements in a large ring

Computing ratio of two elements in a large ring I have a ring (a matroid Chow ring) which has a large number of generato

2022-11-01 23:30:11 +0200 received badge  Popular Question (source)
2022-10-13 19:35:50 +0200 marked best answer Poset whose elements are frozen sets

I'm trying to create a poset whose elements are frozen sets (they are certain chains of subsets of flats of a matroid), and I'm getting unexpected behavior. For example:

sage: elts = [frozenset({1, 2, 3}), frozenset({3, 4, 5}), frozenset({1, 3, 4})]                                                                     
sage: rels = [frozenset({1,2,3}), frozenset({3,4,5})]                        
sage: Poset(elts, rels)                                                      
Finite poset containing 6 elements

The elements are:

frozenset({1, 2, 3})
2
frozenset({3, 4, 5})
3
4
5

Why does this happen?

2022-10-13 04:32:00 +0200 asked a question Poset whose elements are frozen sets

Poset whose elements are frozen sets I'm trying to create a poset whose elements are frozen sets (they are certain chain

2022-07-14 14:47:13 +0200 received badge  Famous Question (source)
2021-04-09 05:38:26 +0200 marked best answer "Ratio" of two elements in a ring

Suppose I have a $\mathbb{Q}$-algebra R, and I have two elements x and y in R. I happen to know that x is a scalar multiple of y. Is there a way to figure out what the scalar is?

In other words, I want to identify the $\mathbb{Q}$-span of y with 1-dimensional vector space, choose an isomorphism of this vector space with $\mathbb{Q}$ (sending y to 1), and see where x goes.

The general context is that R is a finite-dimensional graded $\mathbb{Q}$-algebra (given as a quotient of a polynomial ring), and the top degree piece has dimension 1. I have an isomorphism of this top degree piece with $\mathbb{Q}$ (defined by sending a certain element to 1), and I want to be able to compute what it does to other elements.

An example of such a ring: let $A = \mathbb{Q}[x_1, x_2, x_3, x_4]$. Let $I_1 = (x_1x_3, x_2x_4)$. Let $I_2 = (x_1 + x_3, x_2 + x_4)$. Let $R = A/(I_1 + I_2)$.

(Note that $R$ is the Stanley-Reisner ring of simplicial complex (a triangulation of the circle) modulo a linear system of parameters. So it is graded by degree, and as the simplicial complex is a circle, the degree 2 is a 1-dimensional vector space.)

Let $y = x_1 x_2$, and let $x = (x_1 + x_4)(x_2 + x_3)$. Then x is a scalar multiple of y (as they are both in degree 2), and I would like to know what the scalar is.

(In this case, x = 2y.)

Later edit: fixed typo

2021-04-09 05:38:19 +0200 edited question "Ratio" of two elements in a ring

"Ratio" of two elements in a ring Suppose I have a $\mathbb{Q}$-algebra R, and I have two elements x and y in R. I happe

2021-04-09 05:37:55 +0200 edited question "Ratio" of two elements in a ring

"Ratio" of two elements in a ring Suppose I have a $\mathbb{Q}$-algebra R, and I have two elements x and y in R. I happe

2021-04-08 19:38:27 +0200 edited question "Ratio" of two elements in a ring

"Ratio" of two elements in a ring Suppose I have a $\mathbb{Q}$-algebra R, and I have two elements x and y in R. I happe

2021-04-08 04:40:24 +0200 asked a question "Ratio" of two elements in a ring

"Ratio" of two elements in a ring Suppose I have a $\mathbb{Q}$-algebra R, and I have two elements x and y in R. I happe

2021-04-08 03:54:01 +0200 received badge  Popular Question (source)
2021-04-08 03:52:41 +0200 received badge  Famous Question (source)
2021-04-06 10:34:23 +0200 received badge  Famous Question (source)
2020-11-30 04:46:52 +0200 received badge  Famous Question (source)
2020-01-07 18:16:16 +0200 received badge  Notable Question (source)
2019-11-07 07:06:02 +0200 received badge  Notable Question (source)
2019-01-02 22:08:29 +0200 received badge  Notable Question (source)
2018-12-25 12:46:51 +0200 received badge  Nice Question (source)
2018-12-24 17:29:23 +0200 asked a question Computing heights of large degree algebraic numbers

I have an irreducible polynomial of large degree (I would like to go up to degree ~1000), and I would like to compute the height of its roots. Currently I am doing this:

def irreducible_root_height(f):
    K.<y> = NumberField(f)
    h = y.global_height()
    return h

This is rather slow because I have to construct the number field. Is there a way to find the height without constructing the number field?

I tried to use the functionality with general algebraic numbers, but there doesn't seem to be a way to define an arbitrary root of a polynomial in QQbar. It also looks like computing the height of something in QQbar works by computing a number field, so this wouldn't be any faster.

2018-09-25 13:23:54 +0200 received badge  Popular Question (source)
2018-07-25 23:00:44 +0200 asked a question Elements of the Stanley-Reisner ring

I have a simplicial complex, and I'm trying to manipulate the Stanley-Reisner ring of that simplicial complex. This is just a quotient of a polynomial ring. The generators of the quotient ring are called (according to R.gens()) x0bar, x1bar, x2bar, x3bar. However, when I try to refer to elements of the ring in this way (for example, to create an ideal containing certain elements), I get an error. For example:

sage: X = SimplicialComplex([[1,2,3], [0,2,3], [0,1,3]])
sage: R = X.stanley_reisner_ring()
sage: R(x0bar)

This gives me the following error:

NameError                                 Traceback (most recent call last)
<ipython-input-3-b65205a640d6> in <module>()
----> 1 R(x0bar)

NameError: name 'x0bar' is not defined
2018-04-05 10:45:16 +0200 received badge  Notable Question (source)
2018-02-02 18:15:05 +0200 received badge  Popular Question (source)
2017-12-18 23:54:44 +0200 received badge  Popular Question (source)
2017-08-21 05:11:49 +0200 asked a question Changing the weights in a graph

Suppose I have a weighted graph G, and I want to change the weights of some of the edges. One way to do this is to output the weighted adjacency matrix, modify it, and then recreate the graph. Is there a more efficient way?

2017-08-19 00:56:20 +0200 received badge  Popular Question (source)
2017-08-05 10:50:47 +0200 received badge  Self-Learner (source)
2017-08-05 10:50:47 +0200 received badge  Teacher (source)
2017-08-01 04:42:07 +0200 answered a question Paths beginning with a certain vertex

I'm not sure if this is the most efficient, but I did find a way. If you want the the path to begin with (v1, v2), then you can use:

    S = list(SubgraphSearch(G, graphs.PathGraph(n)))
    S[:] = [path for path in S if (path[0] == v1 and path[1] == v2)]
2017-08-01 00:09:40 +0200 asked a question Paths beginning with a certain vertex

So I have a graph $G$ and a distinguished vertex, labeled with $0$ say. I would like to create a list of all paths of length $k$ that start with $0$.

One way I see how to do this with subgraph_search is to change $0$ into a large clique (larger than the clique number of $G$) and then use subgraph_search_iterator to find all subgraphs with a large clique connected to a path of length $k-1$. However, this seems pretty inefficient. Is there a better way?

2017-06-29 20:46:35 +0200 asked a question Using the small group library in Sage notebook

Is there any way to import groups from the GAP small group library into Sage notebook?

I've tried importing the library using the terminal, but I haven't been able to. When I run

sage -i database_gap

while running sage in the terminal, I get an invalid syntax error.

I am running Mac OS X 10.12.5

When I run sage -i database_gap in the notebook, I get the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_9.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2FnZSAtaSBkYXRhYmFzZV9nYXA="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/private/var/folders/hn/_c_yl0fj0zlfwvzcy0f5138w0000gp/T/tmpEaYQvh/___code___.py", line 2
    sage -i database_gap
                       ^
SyntaxError: invalid syntax
2016-11-23 21:13:05 +0200 asked a question Evaluating characters of linear algebraic group

How would I evaluate the characters on $SL_2(\mathbb{F}_q)$ on some conjugacy class (which I know one element of). I think I will have to use the port to GAP, as constructing characters of non-permutation groups doesn't seem to implemented. I could construct the character table, but that is maybe inefficient.

2016-09-26 23:01:48 +0200 asked a question Generating all elements of $SL_2(\mathbb{F}_q)$

What is the fastest way to create a set with all elements of $SL_2(\mathbb{F}_q)$ for $q$ some prime power of size about $50$? One way to do it is to find a representative for each conjugacy class and then use the ConjugacyClass method, but this seems inefficient. Is there a better way?

2016-09-04 23:25:14 +0200 commented answer Finding the maximum on an interval and find root

scipy is giving me the wrong answer. Also, I am looking for the x-value of the giant spike that occurs at about 5.56, not the maximum on [0, 2pi]. (There are many local maximum around there, so find local maximum doesn't work.)