Ask Your Question

Leon's profile - activity

2024-04-14 08:16:33 +0200 received badge  Notable Question (source)
2023-12-09 20:22:15 +0200 received badge  Popular Question (source)
2023-12-09 20:22:15 +0200 received badge  Notable Question (source)
2021-09-13 21:41:47 +0200 received badge  Famous Question (source)
2021-03-29 21:11:47 +0200 received badge  Popular Question (source)
2020-06-12 20:15:38 +0200 received badge  Notable Question (source)
2020-05-07 11:18:11 +0200 received badge  Famous Question (source)
2020-05-06 01:15:20 +0200 asked a question Hochschild cohomology of a matrix subalgebra

Let $M_n(R)$ be the $n\times n$ matrix algebra over the polynomial ring $R=K[t]$. It is spanned by ${e_{ij}; i,j\in[n]}$.

Let $A$ be a subalgebra of $M_n(R)$, spanned by ${p_{ij}e_{ij}}$, where $(i,j)$ ranges over some subset of $[n]\times[n]$ and $p_{ij}\in R$ are some polynomials. How can I compute with SageMath the hochschild (co)homology $HH^\ast(A;A)$?

So far, I know how to do some basics:

R.<t>=GF(3)[]; 
A.<x,y> = ExteriorAlgebra(QQ); 
C = A.hochschild_complex(A); print(type(A),'\n',type(C))
show(C.homology(0),', ',C.homology(1),', ',C.homology(2))
show(C.cohomology(0),', ',C.cohomology(1),', ',C.cohomology(2))

However, I don't know how to create my matrix subalgebra $A$ over $R$. Also, I don't think this really computes hochschild cohomology. Is it dualised over $\mathbb{Q}$ or over $A=\Lambda_\mathbb{Q}[x,y]$?

2020-01-14 15:45:17 +0200 received badge  Commentator
2020-01-14 15:45:17 +0200 commented question finite simplicial complexes, projective spaces, facets, giving strange output

@FrédéricC Not even that, since some tuples end in a comma, not an integer. Anyway, how can I get maximal simplices which have integers for vertices?

2020-01-14 08:34:00 +0200 asked a question finite simplicial complexes, projective spaces, facets, giving strange output

The code

n=2; x=simplicial_complexes.RealProjectiveSpace(n); 
fcts=x.facets(); out=file('P'+str(n)+'.txt','w');
for a in fcts: out.write(str(a)+'\n')
out.close();

writes a nice result in the file P2.txt:

(0, 2, 3)
(0, 3, 4)
(0, 1, 5)
(0, 4, 5)
(2, 3, 5)
(1, 2, 4)
(0, 1, 2)
(1, 3, 4)
(1, 3, 5)
(2, 4, 5)

This works for $n=1,\ldots,4$. However, for $n=5$, the file contains

((1, 5, 6), (1, 6), (1, 3, 5, 6), (6,), (2,), (2, 4))
((1, 2, 4, 6), (5,), (1, 4), (3, 5), (4,), (1, 4, 6))
((3, 4, 6), (1, 3, 4, 5, 6), (4, 6), (1, 3, 4, 6), (6,), (2,))
((1, 5, 6), (1, 2, 3, 4, 5, 6), (1, 3, 5, 6), (1,), (1, 5), (1, 3, 4, 5, 6))
((1, 6), (1, 3, 5, 6), (1,), (1, 2, 3, 5, 6), (1, 3, 6), (4,))
((1, 2), (3,), (3, 5, 6), (1, 2, 4), (3, 5), (2,))
((1, 2), (1,), (3,), (3, 6), (1, 2, 4), (1, 2, 4, 5))
((1, 2), (1,), (1, 2, 3, 6), (4, 5), (1, 2, 6), (4,))
((2, 3, 4), (2, 3, 4, 5), (1, 2, 3, 4, 5), (2, 3), (6,), (2,))
((1, 3, 4, 5), (1, 3, 4, 5, 6), (5,), (3, 5), (2,), (3, 4, 5))
...

What am I doing wrong here? Why don't I get a list of 5-dimensional simplices? I would like to obtain only the facets of the first 10 projective spaces.

2019-12-09 11:31:16 +0200 received badge  Notable Question (source)
2019-07-17 10:53:41 +0200 commented answer Running Sage from the commad line in Ubuntu 12.04

I installed it to /home/leon/sage-8.8. How do I create a command sage that runs the program? I can't find $HOME/.bashrc in the home folder. Btw, I have Linux Mint Mate 19.1.

2019-06-26 17:42:34 +0200 received badge  Popular Question (source)
2019-02-02 11:25:32 +0200 received badge  Enthusiast
2019-01-23 17:18:07 +0200 received badge  Popular Question (source)
2019-01-21 14:43:39 +0200 commented answer Loading a 5GB dictionary of matrices uses up all of 64GB RAM

Now it works, thank you for your help and patience! : ) Using the above code, I've managed to load 7GB of sparse matrices without crashing (but when loaded, they take up 23GB of RAM, a bit strange).

2019-01-19 17:39:49 +0200 commented answer Loading a 5GB dictionary of matrices uses up all of 64GB RAM

Hmm, I still haven't been able to import the file, but probably due to my incompetence. Could you give me specific instructions on how (in what form) to export the file from Mathematica and how to import it in Sage? Do I export it to file.json? Should its content be e.g. [ "bdrs={", "1: matrix(ZZ,1,7,{}),", "2: matrix(ZZ,7,21,{(3,3):-1, (3,9):-1, (3,14):-1}),", "};" ] How do I import this into sage? If I run load('file.json'), I get No such file or directory: '/home/file.json.sobj'. If I run json.loads('file.json'), I get ValueError: No JSON object could be decoded.

2019-01-16 21:25:05 +0200 commented answer Loading a 5GB dictionary of matrices uses up all of 64GB RAM

Oh, that's disappointing. I thought Sage was supposed to be much more efficient than Mathematica. Even when I try to import just the largest matrix (that takes up less that 800MB), Sage uses up 28GB of RAM and crashes.

2019-01-16 11:01:05 +0200 received badge  Good Question (source)
2019-01-16 09:34:09 +0200 received badge  Nice Question (source)
2019-01-16 00:42:46 +0200 asked a question Loading a 5GB dictionary of matrices uses up all of 64GB RAM

In a 5GB file.sage, I stored a chain complex as a dictionary of sparse matrices (created it in Mathematica with no problems). When I run load(file.sage), the program uses up all 64GB RAM + 64GB swap and crashes. Why does Sage use that much of memory for a small file?

I tried splitting the file into three smaller ones and load one after another, but already with the first 1.3GB file, the system crashes after using all RAM, but without using swap. I get:

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-1-8cecfac681b8> in <module>()
----> 1 load('/home/leon/file.sage');

sage/structure/sage_object.pyx in sage.structure.sage_object.load (build/cythonized/sage/structure/sage_object.c:12879)()

/usr/lib/python2.7/dist-packages/sage/repl/load.pyc in load(filename, globals, attach)
    245             if attach:
    246                 add_attached_file(fpath)
--> 247             exec(preparse_file(open(fpath).read()) + "\n", globals)
    248     elif ext == '.spyx' or ext == '.pyx':
    249         if attach:

MemoryError:
2019-01-11 18:08:26 +0200 commented question max memory used during a process

Any ideas?

2019-01-07 22:00:12 +0200 asked a question max memory used during a process

In Mathematica, the command MaxMemoryUsed[computation] tells you what the largest usage of RAM was when executing some computation. Is there a similar comand in SageMath?

2018-10-28 15:45:02 +0200 commented answer ChainComplex() runs 24 times slower than homology()

Surely, ChainComplex() detects that these are sparse matrices, otherwise I wouldn't have enough RAM to store $10^6\times10^6=10^{12}$ entries... But still, thank you for your help!

2018-10-28 15:42:00 +0200 commented answer ChainComplex() runs 24 times slower than homology()

Aaah, you're right, with check=False, it only takes 3sec. Sorry for not noticing this option in the documentation, and thank you for your help!

2018-10-28 12:15:41 +0200 received badge  Nice Question (source)
2018-10-28 09:55:39 +0200 asked a question ChainComplex() runs 24 times slower than homology()

I load a list of matrices bdrs representing a chain complex, their dimensions are {1, 21, 210, 1330, 5985, 20349, 54264, 116280, 203490, 293930, 352716, 352716, 293930, 203490, 116280, 54264, 20349, 5985, 1330, 210, 21, 1}, and the largest has density 3.91*10^-6. In total they take up 50MB of disk space. This finishes in 63sec.

When I run chcx=ChainComplex(bdrs,base_ring=GF(2)), it takes 7hrs20min, but chcx.homology() finishes in only 18min. Why does it take so long to just store a few matrices? At first I thought that ChainComplex() also does some simplifications/reductions, but [chcx.free_module_rank(i) for i in range(0,21)] shows the original dimensions of matrices :/.

Is there a faster way to compute the homology of a chain complex (over $\mathbb{Z}$ or $\mathbb{Z}_p$)?

2018-10-27 10:45:21 +0200 received badge  Scholar (source)
2018-10-27 10:45:15 +0200 commented answer How to read and run commands from a text file?

Yes, I'll be computing a lot of homology of chain complexes. Thank you for your answers!!

2018-10-26 23:14:38 +0200 received badge  Supporter (source)
2018-10-26 22:54:42 +0200 commented answer How to read and run commands from a text file?

Great, it works! Could you also please answer the question about RAM, before I accept?

2018-10-26 22:14:01 +0200 received badge  Student (source)
2018-10-26 22:10:54 +0200 asked a question How to read and run commands from a text file?

I have all my commands in a text file, and I would just like to run them in Sage. What is the easiest way to do this?

For example, in sage.txt, I have written:

d0=matrix(ZZ,4,4,{(0,0):1,(2,0):1,(1,1):1,(3,1):1,(1,2):1,(3,2):1});
d1=matrix(ZZ,4,4,{(1,0):-1,(2,0):-1,(3,1):-1,(1,2):1,(2,2):1,(3,3):1});

The command with open('/home/sage.txt','r') as ll: bdrs=[sage_eval(l.strip()) for l in ll]; returns

File "<string>", line 1
    d0=matrix(ZZ,Integer(4),Integer(4),{(Integer(0),Integer(0)):Integer(1),(Integer(2),Integer(0)):Integer(1),(Integer(1),Integer(1)):Integer(1),(Integer(3),Integer(1)):Integer(1),(Integer(1),Integer(2)):Integer(1),(Integer(3),Integer(2)):Integer(1)});
      ^
SyntaxError: invalid syntax

Also, does Sage have a limit on how much RAM it can use? If yes, how can I increase the available memory?