2019-10-09 07:27:58 -0600 | asked a question | How to draw the following graph in sagemath? How to draw the following graph in sagemath? I am uploading the image here: I know how to draw a graph but I am finding it difficult to draw the graph in exactly the same way as shown in the picture. Is it possible to do this? I will be very grateful if someone could kindly help me out |
2019-09-25 06:24:59 -0600 | asked a question | How to find the subgraph homeomorphic to $K_5$ or $K_{3,3}$? Given a graph $ G$ it is easy to check whether the Graph is planar or not using the command "$G$.is_planar()" However I am stuck on the following : Given a non-planar graph $G$ is it possible to find a subgraph of $G$ which is homeomorphic to $K_5$ or $K_{3,3}$? As per Kuratowski Theorem any Graph $G$ is planar if and only if $G$ has a subgraph homeomorphic to $K_5$ or $K_{3,3}$. Is it possible to find the required subgraph using sagemath? |
2019-08-28 06:40:55 -0600 | asked a question | Given a matrix $M$ how to form the following matrix $N$ from $M$.
Suppose $M=$\begin{bmatrix} 0 &3 \ 2 &0 \end{bmatrix} Here $M$ is a $2\times 2$ matrix with 1st row $[0,3]$ and 2nd row $[2,0]$. We need to form $N$ such that $N=$ \begin{bmatrix} 3& 3\ 2&2\end{bmatrix} Here $N$ is a $2\times 2$ matrix with 1st row $[3,3]$ and 2nd row $[2,2]$. Thus $N$ is formed from $M$ by just adding all the off the diagonal elements of $M$ in a given row to the diagonal element So the diagonal element of $N$ is the sum of all the remaining entries in a given row of $M$ whereas the rest of the elements of $N$ are the same as $M$. So the elements of $N$ are obtained from $M$ in the following way : $a_{11}=0+3=3, a_{12}=3,a_{21}=2,a_{22}=2+0=2$ How to code it? Please help. |
2019-08-27 03:35:53 -0600 | commented answer | How to draw a graph whose vertices are elements of permutation group Thank you for your answer |
2019-08-27 03:33:41 -0600 | commented answer | How to draw the following graph I am extremely thankful for the answer. Can you kindly say how to start learning coding in sagemath? How to know the way to write loops , how to draw a graph, add edges as you have etc.?? |
2019-08-26 09:02:04 -0600 | asked a question | How to draw the following graph I want to write the following code in sagemath but unable to write it: Suppose we consider the group $\Bbb Z_n$. We consider an element $a\in \Bbb Z_n$ and form the subgroup generated by $a$ i.e. $\langle a\rangle ={a,2a,3a,\ldots 0}.$ We form a graph $G$ whose vertices are $\langle a\rangle $ and $\langle a\rangle $ and $\langle b\rangle $ are adjacent if either $\langle a\rangle \subset \langle b\rangle $ or $\langle b\rangle \subset \langle a\rangle $ . How to plot the graph $G$ is Sagemath? I am giving an example to clear the question: Consider $\Bbb Z_4$ then consider $\langle 0\rangle $, $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$ Clearly $\langle 0\rangle ={0}$, $ \langle 1\rangle={1,2,3,0}$ , $ \langle 2={2,0}\rangle$, $ \langle 3={0,1,2,3}\rangle$. Thus the graph $G$ has vertices as $\langle 0\rangle $, $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$ and $\langle 0\rangle $ is adjacent to $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$, $\langle 1\rangle $ is adjacent to $ \langle 2\rangle$ , $ \langle 0\rangle$, $\langle 2\rangle $ is adjacent to $ \langle 1\rangle$ , $ \langle 0\rangle$, $ \langle 3\rangle$ and $\langle 3\rangle $ is adjacent to $ \langle 0\rangle$, $ \langle 2\rangle$ Thus $G$ becomes |
2019-08-05 20:59:06 -0600 | commented answer | How to draw a graph whose vertices are elements of permutation group I am extremely thankful for the answer sir. Can you kindly explain the logic behind "if x in d: d[x].append(y) else d[x]=[y]" If you could explain why is it written this way I will be grateful |
2019-08-05 20:53:26 -0600 | received badge | ● Citizen Patrol (source) |
2019-08-05 20:53:23 -0600 | commented answer | Code to find separating set in SageMath of a given Graph Okay Thank you so much |
2019-08-05 08:51:11 -0600 | asked a question | How to draw a graph whose vertices are elements of permutation group How to write the following program in SageMath: Consider the Permutation Group $S_3$. The elements of $S_3$ are $e,(12),(13),(23),(123),(132)$. I want to draw a graph $G$ whose members are the elements of $S_3$ and two vertices $x,y$ are adjacent if and only if $xy\neq yx$. I am stuck in doing the following things:
I can check whether they commute or not but I am stuck in the two things. Is there any way to write the code in SageMath? As an example if I input $S_3$ I want to get the following graph $G=Graph({1:[2,3,4,5],2:[1,3,4,5],3:[1,2,4,5],4:[1,2,3],5:[1,2,3]})$ Any help will be highly appreciated. |
2019-08-05 00:53:28 -0600 | commented answer | Code to find separating set in SageMath of a given Graph Thanks a lot sir. Can you kindly tell if there is any code which can find all the minimal separating sets of a given graph? How to write such a code |
2019-08-04 09:45:18 -0600 | received badge | ● Popular Question (source) |
2019-08-04 07:52:38 -0600 | asked a question | Code to find separating set in SageMath of a given Graph Given a Graph $G$ how can I find the separating set of the Graph? Suppose I am given this graph G=Graph({1:[2,3,4,5],2:[1,3,4,5],3:[1,2,4,5],4:[1,2,3],5:[1,2,3]}) I want to find the set of vertices whose removal disconnects the graph. I found that the vertex connectivity of $G$ is 2. Also on seeing the graph I find that the set of vertices whose removal disconnects the graph will be $(1,2,3)$ But how to find it using a code in SageMath? |
2019-08-04 07:42:29 -0600 | commented answer | Is there any code to calculate the subgroup generated by the permutations Thank you so very much |
2019-08-04 07:42:16 -0600 | received badge | ● Scholar (source) |
2019-08-04 01:16:11 -0600 | asked a question | Is there any code to calculate the subgroup generated by the permutations Consider the Symmetric Group $S_4$ I have three permutations namely $(3,4), (1,2), (1,3)(2,4)$. How to find the subgroup generated by these permutations ? Is there any code to calculate in Sagemath the subgroup generated by the permutations given above? As an example the code should work like this : If I input $(12)$ the code should give ${(12),e}$ Can someone help please? |
2019-03-15 02:19:27 -0600 | asked a question | How to get rid of the Error Message for calling a text file in SageMath I want to input a matrix from a text file and run it in SageMath. The name of the file is Matrix.It is located in the D-drive and it contains a square matrix of order 4. I changed the the name of the file from Matrix.txt to Matrix.sage. I then wrote load('Matrix.sage'); But I got an error message which read
Is it possible for Sage-Math to take input a matrix which is stored in a Text File? Can someone kindly comment? Note:I want to input the matrix from the text file and find its determinant in SageMath. |
2019-03-14 05:26:56 -0600 | asked a question | How to input in SageMath from a Output of a C-Program I am using Sagemath. I have the following query: I want to find the determinant of a given matrix A. I know it is possible to input the matrix A as A=matrix([[1,3],[3,4]]) and then calculate its determinant as A.determinant() But I want to calculate determinant of a matrix in the following way: The matrix A is generated by a C-Program.So I have a C-Program which is Matrix.c and its corresponding output file Matrix.exe. I want to use the matrix A generated from the Program in Sagemath and find its determinant. Is it possible to input in Sagemath from a output file of a C Program? I need some help. |
2018-08-29 06:40:14 -0600 | received badge | ● Editor (source) |
2018-08-29 06:37:14 -0600 | asked a question | How to find non-trivial solution of the system in SageMath?? I want to solve a matrix equation in SageMath. I have this matrix $M=$ \begin{bmatrix} 1&1&1&1&1&1&1 1&-1&1&1&1&0&0\ 1&1&-1&1&1&0&0\ 1&1&1&-1&1&0&0\ 1&1&1&1&-1&0&0\ 1&0&0&0&0&-3&1\ 1&0&0&0&0&1&-3\ \end{bmatrix} I have found that det(M)=0 so there exists a non-trivial solution to $MX=0$ I want to solve the equation $MX=0$ but when I solve it in Sagemath I only get the solution $X=0$ How to find non-trivial solution of the system in SageMath?? Please help. |
2018-03-18 14:12:08 -0600 | received badge | ● Student (source) |
2018-03-18 14:07:06 -0600 | asked a question | How to draw figures of Polygons in SageMath I want to draw a picture of a polygon in SageMath which will be unfilled i.e I want to draw figures of triangle,square,pentagon,hexagon and so on and then draw a figure with say 100 sides. I checked the web. I only found plots of 3d figures ,I want 2d figures . Is it possible to draw such a figure in SageMath. Please help me |
2018-02-27 10:17:14 -0600 | asked a question | How to write the given program in sage I am new to sage. I have learned the basics of sage programming from various online notes. I am interested to apply sage in linear algebra and graph theory. My problem is I want to draw a graph as follows: Vertices : Subspaces of a vector space of dimension $n$. Edges: $V_1V_2\iff V_1 \subset V_2$ or $V_2\subset V_1$. Please don't give me the solution. Please help me how to write it step by step or give some resources from where I can find this. |