Ask Your Question

Dima's profile - activity

2019-01-29 12:41:20 -0600 answered a question possible to solve this optimizationproblem with LMI?

Yes, semidefinite optimisation is available in Sage, check out

2018-12-17 23:09:09 -0600 commented answer ImportError: No module named 'sage'

put that one like into a file, and source it every time you want to start anaconda. (Better, make a script that sources this line and starts Anaconda for you).

2018-05-02 17:34:08 -0600 received badge  Nice Answer (source)
2018-03-22 11:19:56 -0600 commented question save/load session in standalone python

In ipython there are special tools for this (I guess they are used in e.g. Jupyter notebook environment to save the state), see e.g.

2018-03-07 06:16:38 -0600 received badge  Nice Answer (source)
2018-03-05 20:40:52 -0600 answered a question Error with is_prime

Thanks. This is the fix (the whole id_label business was a leftover from an old buggy implementation of the modular decomposition, now replaced with this one. Will be fixed in the upcoming release.

diff --git a/src/sage/graphs/ b/src/sage/graphs/ index 617881e4a7..57504aaecd 100644
--- a/src/sage/graphs/
+++ b/src/sage/graphs/
@@ -7180,9 +7180,7 @@ class Graph(GenericGraph):

         D = modular_decomposition(self)

-        id_label = dict(enumerate(self.vertices()))
-        relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type !=NodeType.NORMAL else id_label[x.children[0]]
+        relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else x.children[0]

          return relabel(D)
2017-11-13 06:08:53 -0600 received badge  Civic Duty (source)
2017-10-05 05:17:08 -0600 commented question Build Error when Uploading Notebooks in Sage

thanks, see for this problem.

2017-08-09 12:20:16 -0600 received badge  Nice Answer (source)
2017-07-18 04:30:22 -0600 commented answer Submatrix of a given matrix by deleting some rows and columns(For my case 2 rows and columns).

Well, but this is a straightforward Python loop to write. In the loop, create two lists, say, ro, co, using range(), remove i-th (resp. j-th) elements from it, call A[ro,co].det()/A[ro,ro].det() to compute the corr. determinant ratio, store it in B.

2017-07-18 02:45:35 -0600 commented question How to obtain the resistance distance matrix of a graph?

I imagine that scipy does not convert the pseudo-inverse exactly. Anyhow, please specify the example of a graph on which you see the problem.

2017-07-18 02:18:34 -0600 commented answer Restricted usability of Singular after upgrade

there is a little 'V' field under the answer score counter on the right, which one ticks to accept the answer. I just did it here.

2017-07-18 02:15:30 -0600 answered a question Submatrix of a given matrix by deleting some rows and columns(For my case 2 rows and columns).

You can create lists of rows and columns and use them to cut out a submatrix. E.g.

 sage: M=matrix([[1,2,3,4],[3,4,5,6],[6,7,8,9]])
 sage: M[[0,2],[0,2]]
 [1 3]
 [6 8]
2017-02-11 12:27:00 -0600 commented answer highest dimension polyhedron

no, not really. See for bounds and examples. E.g. in dimension 13 you might have more than 17000000 facets.

2017-02-09 14:27:16 -0600 answered a question highest dimension polyhedron

this depends on the input quite a bit. Namely, the following factors play a big role:

  • how many facets your polytope $P$ has
  • how big in abs. value the coordinates of your points are (assuming they are all integers)
  • how degenerate $P$ is; i.e. the maximal number of neighbours of a vertex of $P$ --- the more degenerate it is, the slower the facet enumeration)
2017-02-09 14:05:41 -0600 commented answer Restricted usability of Singular after upgrade

Why would you think this is Singular problem? Univariate polynomials are not handled by Singular in Sage, they are handled by either Flint, or NTL, or Givaro (the latter for finite fields only). We need more info to track your issue down. E.g. could you at least tell us the output of type(f) for your polynomial f?

2016-07-28 03:08:22 -0600 commented question second degree irreducible polynomial over extension field

I presume the question is about how to build a quadratic extension of GF(8) explicitly.

2016-07-28 02:08:54 -0600 answered a question Faster function for working with cosets

Here is an example of how to get a list of coset representatives:

sage: g=libgap.AlternatingGroup(5)
sage: h=g.Stabilizer(1)
sage: [x.Representative() for x in g.RightCosets(h)]
[(), (1,5,4), (1,4,5), (1,2,5), (1,3,5)]

Please feel free to ask for more details.

2016-07-26 10:43:19 -0600 commented answer Semimonomial transformation group

I am not 100% sure that you want to start with the permutation group - it might be a proper quotient of the "real" group, and then you need to do something else.

2016-07-26 10:42:10 -0600 answered a question Semimonomial transformation group
 sage: g=libgap.Group(map(lambda s: libgap.PermList(s.get_perm()), Gautgens))

will give you the underlying permutation group. It has 1 orbit in its natural action (on 8 points):

 sage: g.Orbits()
 [ [ 1, 2, 5, 3, 6, 4, 7, 8 ] ]

You can convert it into a matrix group acting on GF(4)^8.

 sage: mg=libgap.Group(map(lambda s: libgap.PermutationMat(s,8,libgap.GF(4)), g.GeneratorsOfGroup()))

Now you can compute orbits on vectors (see e.g. code in graphs/generators/ for details); however, you might want to make sure that GAP's GF(4) is created in a compatible way.

2016-07-20 04:09:29 -0600 received badge  Good Answer (source)
2016-04-04 13:23:39 -0600 commented question osx installation

sounds like you've changed the default OS configuration, as on OSX the system python is still python2, and this means that you won't see any missing brackets in print, normally speaking. What is that extra hack that you have on? Homebrew? Anaconda? Something else?

2015-11-03 08:56:21 -0600 commented answer After upgrade to 6.9 we obtain SIGILL ...

I take this as you have an upgraded Mac, right? And which version of OSX? (IMHO it's a non-standard config anyway, and you'd be best off building from source.)

2015-05-12 11:10:03 -0600 answered a question public.pem File Not Created in OSX Lion
2015-04-16 01:58:08 -0600 received badge  Nice Answer (source)
2015-04-13 05:48:54 -0600 answered a question Matrix dot multiplication slowness and BLAS versions

numpy in Sage uses Atlas for matrix operations; if you use a binary Sage installation then Atlas might be not optimised for your hardware. To get good Atlas performance, the best is to build Sage from source.

2015-02-10 03:23:06 -0600 answered a question System of 3 equations in 3 variables with symbolic coefficients

I very much doubt that there are closed form solutions for such a system. It looks like this would imply that univariate polynomial equations of arbitrary degrees have a closed form solution, which is well-known not to be the case.

2015-02-06 11:31:52 -0600 answered a question Build command for LaTeX project

as a last resort, open the terminal, run latex or pdflatex there...

2015-02-05 03:25:27 -0600 commented question Browser needed

I guess no, that's good as it is.

2015-02-04 14:11:50 -0600 commented answer Multi-user environment

yes, Control-C is good. One can also run 'sage -n' --- this immediately opens the notebook.`

2015-02-04 07:23:22 -0600 commented answer Multi-user environment

in case you might like to know where the notebook files are: they are in ~/.sage/ for the account Sage (nb) is executed from.Thus each user in this configuration will have completely own set of notebooks.

2015-02-03 03:41:43 -0600 commented answer Multi-user environment

a regular Linux user's notebook() will be run in his/her Linux account. They will be admin for this notebook server, by default (unless they specify another user in notebook() call, or log in via the browser to another, suitably created, nb account).

2015-02-03 03:33:11 -0600 commented answer Multi-user environment

In the latter case you don't even need Sage nb users to have Linux accounts on the server, but watch out for security settings in this case...

2015-02-03 03:31:14 -0600 commented answer Multi-user environment

There are two things you can do - either let each user on the machine to run Sage separately, just by running /usr/tmp/sage/sage-6.4.1/sage, or you run a "public" Sage nb server. In the latter setup accounts on the (Linux) server have nothing to do with accounts on the Sage nb server.

2015-02-01 12:59:55 -0600 commented question Multi-user environment

have you installed it systemwide, or in your own account?

2015-02-01 03:10:56 -0600 answered a question How do I register so I can use the Sage Notebooks

You don't have to "register" for this. You just have to set up a password. Try starting notebook from Sage prompt as follows


This should allow you to choose a new password for the admin user (admin is the user id for the sage notebook that already exists).

2015-01-23 15:36:35 -0600 commented answer Cannot install Cremona database

as you see, "Use 100%" means "no room left"... I'd let it be 30-50GB instead of 6.8GB. Regarding the resizing, there is plenty of info on the net, e.g.

2015-01-22 02:59:21 -0600 commented answer Cannot install Cremona database

to see how much space you have in VM, please run, in VM's terminal, the command
df -h

2015-01-19 15:42:49 -0600 commented question Is there a bug with using chromatic_number together with Gurobi?

to reproduce this, it would be good to know precisely on what G it hangs, and also your Gurobi and Sage versions...

2015-01-02 07:26:36 -0600 commented question Jmol applet in Sage 6.3 cannot load

how about the latest stable version of Sage, 6.4.1?

2014-12-23 08:48:11 -0600 answered a question PYCURL ERROR 7 trying to install pdflatex

Sorry, but this is certainly not Sage-specific problem, rather it is a CentOS-specific weirdness If you google this error, you'll see plenty of discussions about it; apparently it's about ip6.

2014-12-15 10:56:03 -0600 received badge  Nice Answer (source)
2014-12-13 19:41:43 -0600 commented answer no method available for opening http localhost 8000 (second part)

probably - although perhaps the VM Sage image has it differently. One can see the port number if you start sage in terminal and do 'notebook()' at sage prompt. It will tell you which URL to open in browser.

2014-12-13 07:23:29 -0600 answered a question no method available for opening http localhost 8000 (second part)

I suppose this is described in Sect 6.3.1 of

Sage notebook runs a webserver that is to be accessed on port 8000 (and this happens inside VM, on "guest OS"). You need a setting that maps this port to a port X (X need not be equal to 8000) on the "host OS"; then you can access the Sage notebook from the "host OS" by pointing its web browser to http://localhost:X

2014-12-12 16:08:10 -0600 commented answer Calculation of symbolic eigenvalues

in your link it works because the matrix is 3x3. Generally speaking, for matrices bigger than 4x4 it will fail, due to impossibility to have a general formula for roots of polynomials of degree bigger than 4.

2014-12-12 07:54:40 -0600 answered a question Integral not being computed correctly

you can certainly compare the numeric outputs for constants: in maxima you do


and you get 0.729009112317963 - 13.831305954985441e-9 %i, while the Mathematica's constant term is


is 0.9958449670166816. So it's really different answers, and probably Maxima is wrong, as the imaginary term looks suspiciously large.

The only way to find out for sure is to compute this by some other means...