Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sagemath]

For questions concerning the mathematical software system SageMath. Consider whether your question would be a better fit at [ask SageMath](http://ask.sagemath.org/).

0
votes
0answers
29 views

Generating words in a finitely presented group in SAGE

I'm trying to get a list of all words of length $n$ (in the word metric sense) in some finitely presented group. I have tried some very naive enumerations but it is very slow. Is there an efficient ...
0
votes
1answer
19 views

How to translate an element in a Coxeter group written as a matrix in Sage to reflections (a list)?

I am trying to use Sage to reduce a word to a reduced word. For example, consider the word $w=[4, 3, 2, 4, 3, 2, 1, 2, 4, 3, 2, 1, 3]=s_4s_3s_2s_4s_3s_2s_1s_2s_4s_3s_2s_1$. I used the following code ...
2
votes
2answers
82 views

Is there a matrix logarithm in Sage?

I just started using SageMath to do some linear algebra computations. The exponential map $\exp$ is built in for matrices. Is the logarithm $$\log(u) = (u-I) - \frac{1}{2}(u-I)^2 + \frac{1}{3}(u-I)^...
2
votes
1answer
58 views

Calculating iterated integral using Sagemath

I would like to calculate the integral over the following domain (with order $x,y,z$) using Sagemath $$0 \le z \le 3, \max\{ 0,\frac{z-1}{2}\} \le y \le 1, \max \{y,z-2y\} \le x \le 1. \tag{1} \label{...
2
votes
1answer
64 views

Homology of a chain complex with unknow boundary map

Question. Let $(C_\bullet,\partial)$ be a $\mathbb{Z}/2\mathbb{Z}$-chain complex generated by $a$, $b_1,b_2,b_3$, $c_1,c_2$ with gradings: $$|a|=2,|b_1|=|b_2|=|b_3|=1,|c_1|=|c_2|=0.$$ Which ...
0
votes
1answer
19 views

quadratic gauss sum calculation in sage

I tried to calculate quadratic gauss sum in SAGE but it works just for primes 3 and 5 which are $i\sqrt{3}$ and $\sqrt{5}$ respectively. p=3 print sum((legendre_symbol(x,p))*(e^(2*piIx/p)) for x in ...
0
votes
3answers
60 views

Sage code to check independence of rational points on elliptic curve

Suppose I have three rational points $(x_1,y_1),(x_2,y_2),(x_3,y_3)$ on certain elliptic curve. Then they are linearly independent if and only if the determinant of matrix $(<P_i,P_j>)_{i,j}$ is ...
0
votes
0answers
10 views

periodicity of a word

I have the following code to create words. sage: M. = FreeMonoid(3) sage: Word(x^3yxz^2x) word: xxxyxzzx I want find the periodicity of a given word. For example ababab has periodicity 3 and ...
-1
votes
2answers
62 views

Why is (1-t)^2 == (t-1)^2 in SageMath?

This is really odd, not much to say about it. ...
2
votes
1answer
80 views

Command to compute the number of $5$-colorings of all $(2k, k^2)$-graphs

I would like Sage to compute the number of all $5$-colorings of graphs on $2k$ vertices and $k^2$ edges with clique number 3 for a specified $k \geq 1$. I know how to ask call nauty and ask sage to ...
2
votes
1answer
67 views

Erdős-Straus-conjecture using polynomials in Python

I am trying to write a code in Python to do the following. We can express the Erdős-Straus-conjecture in function of some polynomials $x(k), y(k), z(k) \in \mathbb{Q}[k]$ such that $\frac4k = \frac{1}...
1
vote
1answer
48 views

Understanding Output in SageMath Regarding Dirichlet Characters

p=7 G = DirichletGroup(p); G m=3; n=ZZ((p-1)/m); print m,n c=G[1] c1=c^n;c1 The output is: ...
1
vote
1answer
71 views

Plotting a solution of a differential equation with Sagemath

I need to solve a differential equation. The solution will depend on $t$ and $q$, and I need to define that $q$ piecewise depending on $t$. ...
0
votes
1answer
40 views

Solving Cauchy's problem with a discontinuous function

I have the Cauchy problem: $$\begin{cases} f'=g(t)+2(f-5) \\ f(0)=2\end{cases}$$ Now $g(t)$ is a periodic function: $$g(t)=\begin{cases} 0,t\in(24k,24k+8)\\ 2,t\notin(24k,24k+8) \end{cases}$$ for $k=...
0
votes
1answer
56 views

How to make a list of variables in Magma(computer algebra system)?

In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code: ...
0
votes
1answer
57 views

Find Tangent Points of Circle and Two Lines in First Quadrant

I need to define explicit expressions to find the points (x1,y1) and (x2,y2), which are the two tangent points of a circle with radius r (known) and two lines (equations known). The center of the ...
0
votes
1answer
25 views

What are the conditions on using Eisenstein reduction of ternary quadratic forms?

The ternary quadratic form $Q(x,y,z) = -3 x^2 + 3 x y + 3 x z - y^2 - y z - z^2$ is not positive definite. In Sage, using code found in this link, Q = TernaryQF([-3, -1, -1, -1, 3, 3]) Qr, m = Q....
1
vote
0answers
28 views

Minimum Spanning set for a given vector

I have a matrix $M \in \mathbb{Q}_{r \times c}$, where $r << c$ and I want to know what is the minimum number $s$ such that some $s$ columns of the matrix span a given vector $v \in \mathbb{Q}^r$...
4
votes
1answer
92 views

Division polynomial of a super-singular vs ordinary Elliptic Curve

For an Elliptic Curve in Finite Field of characteristic $p$, I'm trying to understand how the division polynomial for multiplication by field-characteristic differs between an ordinary curve and a ...
0
votes
0answers
41 views

Minimizing function with inequality constraints in R^n

I have a point $p$ in $R^n$, and I need to find the point $q$ which minimizes a distance function $f(p,q)$ with a number of constraints on $q$ (namely, $q$ needs to represent a probability ...
0
votes
0answers
15 views

sage : plotting graph with dotted edges

I need to draw a graph in which some edges are usual and some edges are dotted. I know how to make all the edges dotted (using the option "dotted" for the parameter edge_style of plot). But I need ...
0
votes
1answer
33 views

Show poset in sage enlarging it

I happen to have a finite poset, and when there are many elements and relations in my poset and I type Poset.show() (suppose the name of my poset is Poset), it will create the hasse diagram but you ...
0
votes
1answer
100 views

Example of addition of Twisted Edwards Curve on Sage, Python,..

Can somebody tell me how can I make a example of addition in Twisted Edwards Curve on sage? For example: $ax^2 + y^2 = 1 + dx^2y^2$ Given the following twisted Edwards curve with $a=3$ and $d=2$: ...
-1
votes
1answer
50 views

Polynomial Ring on Sage

Somebody can explain me what does this function do? ...
0
votes
1answer
16 views

natural sub-class of trees in Sage

I want to calculate certain parameter for class of trees like path graphs, star graphs. I dont want to calculate it for all trees with n vertices as this wont help me in my problem. Basically I need a ...
1
vote
2answers
127 views

how can I find the character table of $(Z/9Z)^\times$?

I tried using sagemath. But I don't think sagemath is supporting character table of multiplicative groups of $(Z/nZ)^\times$. Also it would be great if you can suggest a way to calculate character ...
1
vote
1answer
132 views

Using sage to plot 3d region

Say I want to plot $$E_1 = \{(x,y,z)\in\mathbb{R}^3\mid 0\le z\le 1-y, \sqrt{x}\le y\le 1, 0\le x \le 1\}$$ or $$E_2 = \{(x,y,z)\in\mathbb{R}^3\mid 0\le z\le \sqrt{9-y^2}, {3x}\le y\le 3, 0\le x \le ...
3
votes
1answer
105 views

all the possible combinations to create triangles in a determined graph.

Im studying about graphs. I'm trying to get all the possible combinations to create triangles in a determined graph For example for the complete graph $K_5$, I want to get in sage or python the $10$ ...
1
vote
1answer
70 views

All possible binary matrices with some properties

I need to generate all possible $4 \times 4$ symmetric binary matrices with $0$s on its main diagonal and in which $1$ appears $6$ times. Examples: ...
2
votes
0answers
51 views

What is the algorithm error in Python 2? [closed]

I'm having this algorithm in Python 2 ...
1
vote
1answer
37 views

Multiplication over a cyclotomic field in terms of polynomials over the generators.

I'm currently experimenting with multiplication over cyclotomic fields with SageMath. Say we take the example $K=\mathbb{Q}(\zeta_8)$. Then taking the generator of the field as $z$, we define this in ...
0
votes
1answer
57 views

The number of times each irreducible representation in permutation matrix representation

I am studying a code. One of key part is Return a list representing the number of times each IRR is present in the permutation matrix representation. Suppose we have: character table ...
1
vote
1answer
145 views

How to convert a list to a set in sagemath?

I am trying to convert a list to a set in sagemath 8.2 ...
1
vote
1answer
66 views

Sagemath logarithm simplification

Sagemath doesn't simplify the following term$$\sqrt{x}\,\exp\biggl(\ln(x)\cdot\biggl(-\frac{1}{2}\biggr)\biggr)\qquad\text{with } x>0$$ to $1$: ...
1
vote
1answer
113 views

How to use Sage to find irreducible representation of symmetric group

I am not sure if Sage can be used to find the irreducible representations of the symmetric group. For example: For $g = (123)$, we have $$D(a)=\begin{bmatrix}0&0&1\\ 1 & 0 & ...
5
votes
1answer
83 views

Can we find Gaussian primes $\pi = 1 + 8 \mathbb{Z}[i]$ with $N(\pi) < 1000$?

It's an exercise in computational number theory. Either by hand or by computer, can we find the Gaussian primes $\pi = 1 + 8 \mathbb{Z}[i]$? To keep the list finite I guess we could have $N(\pi) <...
0
votes
1answer
21 views

Shortest presentation of a permutation using generators

A question in sagemath: Let $S$ be a set of generators of a permutation group $H\subseteq S_n$ and let $\pi$ be an element in $H$. Is there a way in sage to find the shortest words in the letters $S$...
0
votes
0answers
28 views

Finding all maximally-matchable edges in a bipartite grah sage

Has anyone coded of the algorithm given by Tassa, Tamir. "Finding all maximally-matchable edges in a bipartite graph." Theoretical Computer Science 423 (2012): 50-58 in Sage ?
1
vote
1answer
31 views

Add conditionals to plot in sage

I am trying to implement an algorithm which plots a tropical curve given a tropical polynomial $P(x,y)$. So for instance the graph of $P(x,y)=x+y+0$ should be a union of three half rays, starting at ...
1
vote
1answer
76 views

Define the ring of integers of a number field in sage.

I am new to sage and I searched the documentation, but could not find an answer for defining the ring of integers. ...
1
vote
1answer
56 views

Sage--use spkg coxeter3 in Sage notebook [closed]

I want to use the well-known coxeter3 package (http://math.univ-lyon1.fr/~ducloux/coxeter/coxeter3/english/coxeter3_e.html) in sage-notebook. I've tried 'i' and 'f' but doesn't work, so far I couldn'...
1
vote
2answers
112 views

simplify_full() for sage matrices

My matrix is $$solution = \left(\begin{array}{rrr|r} 1 & 0 & 0 & \frac{2 \, {\left(\frac{2}{k - 2} - 3\right)}}{k - 1} - \frac{4}{k - 2} + 4 \\ 0 & 1 & 0 & \frac{2}{k - 2} - \...
2
votes
1answer
58 views

in SAGE, how to convert a permutation into coxeter-generators (simple reflections)?

For example: for the permutation $[6,3,2,4,1,5]$, we know that $[6,3,2,4,1,5]=(56)(45)(34)(23)(12)(23)(34)(45)(23)$ For Weyl Group of A5, that is $s_5*s_4*s_3*s_2*s_1*s_2*s_3*s_4*s_2$, My question is: ...
1
vote
1answer
90 views

Software package for plotting 3-d splines

Given a finite point set $P \subset \mathbb{R}^2$ and a height function $h:P -> \mathbb{R}$ I want to produce a smooth surface that interpolates between the values $\left\{[p~h(p)]^\top \in \mathbb{...
4
votes
0answers
43 views

What happens with subdivisions of normal fans in Sage?

I've been trying to compute specific subdivisions of a particular 4D complete fan, to try to speed up computations I have started looking into using Sage. The problem I'm having is that I would like ...
0
votes
1answer
142 views

Why does the cube root of a polynomial in a finite field produce a different polynomial when re-cubed?

I'm using SageMath to try and determine whether the cube root of a polynomial exists in a finite field GF(2^8). Whilst raising the polynomial to the minus 3 does produce a root (that is in the finite ...
2
votes
2answers
355 views

How can I find the dimension of an eigenspace?

I have the following square matrix $$ A = \begin{bmatrix} 2 & 0 & 0 \\ 6 & -1 & 0 \\ 1 & 3 &-1 \end{bmatrix} $$ I found the eigenvalues: $2$ with algebraic and geometric ...
1
vote
1answer
126 views

Learn mathematical thinking with open source (SageMath, GeoGebra, …)

Hi do you know a good introduction about mathematical thinking using opensource software like Sage math and/or geogebra ? I found http://abstract.ups.edu/download/aata-20170805-sage-8.0.pdf but I ...
1
vote
1answer
221 views

Polynomial ring over finite field - inverting a polynomial non-prime

I'm trying to recreate the wiki's example procedure, available here: https://en.wikipedia.org/wiki/NTRUEncrypt I've run into an issue while attempting to invert the polynomials. The SAGE code below ...
0
votes
1answer
315 views

Simultaneous diagonalization on more than two matrices

I am trying to find out a way of simultaneously diagonalize multiple (larger) matrices, not necessarily by hand but with some help of Sagemath. Now I understand that for two matrices the method is as ...