Ask Your Question

Lor's profile - activity

2019-04-22 02:53:05 -0600 received badge  Famous Question (source)
2019-01-05 06:11:13 -0600 received badge  Notable Question (source)
2018-09-10 19:11:30 -0600 received badge  Popular Question (source)
2017-10-11 17:29:32 -0600 commented answer Random element in a finitely generated group

Thanks for this very complete answer. However the two matrices I have written were supposed to be just an example: I am interested in subgroups of SL(2,C) generated by some user-defined matrices, and of course SL(2,Z) was the thing to start with. Do you know if one can play in a similar way with other rank 2 subgroups of SL(2,C)?

2017-10-11 02:47:04 -0600 asked a question Random element in a finitely generated group

I would like to define a matrix group by some generators, e.g.

gens = [matrix(CDF,2, [1,0, -1,1]), matrix(CDF,2, [1,1,0,1])]; G = MatrixGroup(gens)

and then to generate random matrices from G. The command

G.random_element()

throws the error message: AttributeError: 'FinitelyGeneratedMatrixGroup_generic_with_category' object has no attribute 'random_element' . I think the problem is due to the fact that my group is infinite, since it works fine if I replace the complex numbers by some finite field. Is there a better solution than just randomly multiplying the generators by hands? I am especially interested in time efficiency, since I need to generate many elements.

2017-10-09 18:26:25 -0600 asked a question Save a plot in a specified directory from notebook

I am using Sage Notebook on Ubuntu 17.04, and I am not quite sure I understand how Sage saves files. What I need to do: run a file in the notebook which produces a bunch of pictures, and save automatically these pictures in a folder of my choice. For instance let us consider the following piece of code, which plots some portions of the graph of the sine function:

for i in range(4):
P=plot(sin, (0,(i+1)*pi/2))
P.save('sin%d.png' %i)

I can find the four pictures in ~/.sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/11/cells/2 and move them somewhere else, but it would be definitely easier to save them in a different folder automatically. I tried to create a new folder MyNewFolder inside the Documents folder and then use the code

for i in range(4):
P=plot(sin, (0,(i+1)*pi/2))
P.save('/home/Documents/MyNewFolder/sin%d.png' %i)

but I got the following error message

Traceback (click to the left of this block for traceback) ... IOError: [Errno 2] No such file or directory:

How should I deal with this?