Is there a SageMath version of Mathematica's '//' shorthand?
SageMath
by reynormalizer
1d ago
If I had some expression `x^2 + x^3 - 31` and I want to apply a previously defined function `f` to it, is there a quicker way of doing `f(x^2 + x^3 - 31)`? I'm thinking along the lines of Mathematica's `x^2 + x^3 - 31 // f`, where `//` applies the function to the expression that precedes it ..read more
Visit website
Finding minimum sub-algebra that contains a set
SageMath
by HalseyMP
1d ago
Hello, I'm trying to understand step 3 in the algorithm 1 provided in the paper "Algebraic Reduction of Hidden Markov Models" by Tommaso Grigoletto and Francesco Ticozzi. It requires me to compute alg($\mathcal{X}$) and it is defined in the paper like so: > Let alg($\mathcal{X}$) denote the minimal sub-algebra of $\mathbb{R}^n$ containing the set $\mathcal{X}$. In example 1 in the paper, the authors give a set $\mathcal{R}$ and the resulting alg($\mathcal{R}$) like this: $$ \begin{aligned} & \mathcal{R} = \text{span}\\{\begin{bmatrix} 1/5 & 1/5 & 3/5 \end{bmatrix}\\}\\\\ & ..read more
Visit website
Finding sup[er]groups of a group
SageMath
by ARG
1d ago
Is there any implemented algorithm [or any algortihm which is not too slow or hard to implement] to find the ***sup***groups of a given group? More precisely, say I have a permutation group $H$ which is given as a subgroup of $S_n$ (the permutation group on $n$ elements) and some integer $k$. Is there a way to find supgroups K of H so that the index of $H$ in $K$ is equal to (or is at most) some number $k ..read more
Visit website
Taking the closure of a braid as a link deletes unlinked components
SageMath
by karl111
1d ago
There is a note in the reference manual about Links that even states that "The strands of the braid that have no crossings at all are removed". This is not the expected behavior and can cause trouble if you generate links using braids. I also don't know an easy workaround. While conjugating the braids works most of the time, if you conjugate a trivial braid it does not. Is there an easy way to circumvent this problem ..read more
Visit website
Generate all connected graphs of order 12 with matching number of 4
SageMath
by licheng
1d ago
In fact, I can use the following code (in conjunction with Erdős and Gallai's theorem) where the number of edges is less than or equal to 38. num_vertices = 12 selected_graphs = [] for g in graphs.nauty_geng(f'{num_vertices} -c 11:38'): if g.matching(value_only=True) == 4: selected_graphs.append(g) len(selected_graphs) I am wondering if it's possible to combine the structure of such graphs to improve efficiency. For example, Let $G$ be a connected graph with 12 vertices and maximum matchings with size of 4. Let $M=\\{u_1u_2,u_3u_4,u_5u_6,u_7u_8\\}$ be a matching. Let $S=V(G)-\\{u_1,u_2\dots u_ ..read more
Visit website
Jupyter finds python kernel but can't find Sage kernel.
SageMath
by xfsxfs@hotmail.com
1d ago
SageMath version 9.5 release 30_1_2022 , using Python 3.11.6, everything seems to work but Jupyter stays sme time trying to connect to Sage Kernel without success ..read more
Visit website
List some cosets of infinite finitely presented group
SageMath
by karl111
6d ago
Example: F. = FreeGroup(); H = [a^3, a*b*a*b^(-1)*a^(-1)*b^(-1), b*c*b*c^(-1)*b^(-1)*c^(-1), c*d*c*d^(-1)*c^(-1)*d^(-1), d*e*d*e^(-1)*d^(-1)*e^(-1), a*c*a^(-1)*c^(-1), a*d*a^(-1)*d^(-1), a*e*a^(-1)*e^(-1), b*d*b^(-1)*d^(-1), b*e*b^(-1)*e^(-1), c*e*c^(-1)*e^(-1),]; G = F/H G is a factor group of the braidgroup on 6 strands. By a result from Coxeter (since 1/6 + 1/3 ..read more
Visit website
Integrate constantly asks for "zero or nonzero"
SageMath
by thethinker
6d ago
I've had this problem like several times today, doing integrals of the form I=1/sqrt(1+(z-z1)^2) from sage.symbolic.integration.integral import indefinite_integral indefinite_integral(I,z) Long error follows, ending with ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(z1>0)', see `assume?` for more details) Is z1 zero or nonzero? So I get that Maxima might want to know if z1 happens to be zero, but unfortunately: ", ".join(map(str, maxima("features")._sage_())) 'integer ..read more
Visit website
Underdertermined system of equations
SageMath
by elle
6d ago
Let's say we have 2 equations and 3 variables (N equations and M variables, where M > N), for example: 0.3*a+0.1*b+0.2*c=10 + E 0.1*a+0.2*b+0.3*c=11 + E We want to find a, b, c that are in the range [0.0, 1.0] and we want to minimize the error E. We want a smooth solutions that in this context means that if we chart a, b, c in a chart, the chart is smooth. How this kind of problems can be approached with sagemath ..read more
Visit website
Combinatorial elements and classes
SageMath
by Gonneman
1w ago
I would like to construct a free module over QQ (for simplicity) whose basis is index by finite sequences of strictly decreasing positive half odd integers (so odd numbers divided by 2). `CombinatorialFreeModule()` seems like the tool to use for this, if I can define the class of sequences mentioned in the previous sentence. I understand that these sequences are in bijection with integer partitions, so I could just use `Partitions()` as in `CombinatorialFreeModule(QQ,Partitions())`. However, I'm trying to improve my understanding of Sage and so I'm trying to program an appropriate class of seq ..read more
Visit website

Follow SageMath on FeedSpot

Continue with Google
Continue with Apple
OR