ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 27 May 2020 22:11:13 +0200what is the equivalent function of mathematica's FullForm in Sage?https://ask.sagemath.org/question/51590/what-is-the-equivalent-function-of-mathematicas-fullform-in-sage/ i'm trying to find the internal representation of matrices in sage. In Mathematica we can simply use FullForm, and this will show that matrices are internally lists in Mathematica. But i could not find any function that does the same in Sage!salWed, 27 May 2020 22:11:13 +0200https://ask.sagemath.org/question/51590/Get bit representation of an elliptic curve group elementhttps://ask.sagemath.org/question/44547/get-bit-representation-of-an-elliptic-curve-group-element/ I can define an elliptic curve using
> E = EllipticCurve(GF(97), [2,3])
I can then compute a group on E using
> G = E.abelian_group()
I can then sample a random element in the group using
> R = G.random_element()
Is there a way I can get a bit string representation of this group element R? Actually, I am implementing a pseudo-random generator scheme, which finally outputs a group element on elliptic curve. I need to convert it to a bit string.pantherMon, 03 Dec 2018 11:38:55 +0100https://ask.sagemath.org/question/44547/Exterior algebra errorhttps://ask.sagemath.org/question/39523/exterior-algebra-error/Hi,
I'm new to Sage, and I've been having a lot of trouble constructing a particular algebra. I want to construct the exterior algebra (over $\mathbb{Q}$) on generators $w_{i,j} = w_{j,i}$ where $1 \le i < j \le n$ for some $n$ (for concreteness, say $n = 6$). I want this particular generating set so that I can define an $S_n$ action, but that's the next challenge. I've been attempting the following rough outline:
1. Construct a vector space $V \cong \mathbb{Q}^n$, with basis $\{v_i\}$.
2. Take a tensor product $V \otimes V$, with basis $w_{i,j} = v_i \otimes v_j$.
3. Take a quotient to impose relations $w_{i,i} = 0$ and $w_{i,j} = w_{j,i}$.
4. Take the exterior algebra on the quotient.
Several possible data structures for $V$ (FiniteRankFreeModule, VectorSpace, FreeModule) seem to fail at step 2. Are tensor products implemented for these? The most promising structure, CombinatorialFreeModule, fails at step 4 for an unknown reason. I get an error "base must be a ring or a subcategory of Rings()", even though the base is $\mathbb{Q}$.
Here's the specific code I've tried.
indices = range(1,7)
V = CombinatorialFreeModule(QQ, indices)
V2 = tensor((V,V))
w = V2.basis()
relations = []
for i in indices:
relations.append(w[i,i])
for j in range(i+1,7)
relations.append(w[i,j] - w[j,i])
R = V2.submodule(relations)
V3 = V2.quotient_module(R)
A = ExteriorAlgebra(V3)
The last line gives an error, "base must be a ring or a subcategory of Rings()". The command `V2.base() in Rings()` returns true, but I can't get around the error.
Any help would be appreciated, either in fixing this error or approaching the construction in a different way.Nat MayerTue, 14 Nov 2017 04:57:15 +0100https://ask.sagemath.org/question/39523/Evaluating characters of linear algebraic grouphttps://ask.sagemath.org/question/35703/evaluating-characters-of-linear-algebraic-group/ How would I evaluate the characters on $SL_2(\mathbb{F}_q)$ on some conjugacy class (which I know one element of). I think I will have to use the port to GAP, as constructing characters of non-permutation groups doesn't seem to implemented. I could construct the character table, but that is maybe inefficient.vukovWed, 23 Nov 2016 21:13:05 +0100https://ask.sagemath.org/question/35703/Several variables, consider polynomail as polynomial only of $X$, group coefficientshttps://ask.sagemath.org/question/33646/several-variables-consider-polynomail-as-polynomial-only-of-x-group-coefficients/Suppose I have variables `d`, `e` and `x` and I somehow using symbolic calculation get polynomial like this:
$$9d^2e^2x^2 - 36d^2ex^3 + 18de^2x^2$$
I want sage to group coefficients at `x` and consider my polynomial as polynomial only of `x`, I want other variables to be no more than just parameters. In short I want to see something like this:
$$9de^2(d + 2)x^2 - 36d^2ex^3$$
Is it possible to exploit such an approach in Sage?
P.S. I shortened my example. In real life example it is not so easy to see such a grouping by hands.petRUShkaThu, 02 Jun 2016 17:25:07 +0200https://ask.sagemath.org/question/33646/Print to latex according to line widthhttps://ask.sagemath.org/question/29630/print-to-latex-according-to-line-width/ Sometimes I need to print to latex really big polynomials. If I use `latex` command I will get something like this (black line means edge of page):
![image description](/upfiles/14434283547657527.png)
Reason is in fact that output of `latex` command exceeds maximum line width. Is it possible to create multi-line formulas by means of sage `latex` command or some other command?petRUShkaMon, 28 Sep 2015 10:21:29 +0200https://ask.sagemath.org/question/29630/IntegerModRing representationhttps://ask.sagemath.org/question/7485/integermodring-representation/How can I generate the elements of IntegerModring(n) in symmetric representation? For example Integers(6) = {0, 1,-1,2, -2, 3}czsanSun, 10 Oct 2010 10:35:27 +0200https://ask.sagemath.org/question/7485/Can I get the invariant subspaces of a matrix group action?https://ask.sagemath.org/question/8971/can-i-get-the-invariant-subspaces-of-a-matrix-group-action/Suppose I have a [EDIT: finitely-generated] matrix group $G \leq GL_n$, acting on $V = k^n$ in the usual way. Is there some way to calculate the $G$-invariant subspaces of $V$? Failing that, is there an easy way to ask if $V$ is irreducible as a $G$-module?Daniel McLauryThu, 07 Jun 2012 18:58:55 +0200https://ask.sagemath.org/question/8971/Unique Representationhttps://ask.sagemath.org/question/9457/unique-representation/Please explain why the following output is as so. How is it possible for id's not to match but the names to be equal?
sage: SP = SetPartitions(5)
sage: a = SetPartitions(5).random_element()
sage: a
{{2, 3, 4, 5}, {1}}
sage: id(a)
190399916
sage: a in SetPartitions(5)
True
sage: a in SP
True
sage: print id(SP); print id(SetPartitions(5))
188090924
188091308
sage: SP == SetPartitions(5)
TrueSLOtoSFTue, 23 Oct 2012 00:00:23 +0200https://ask.sagemath.org/question/9457/Does Sage keep the order of vertices in a graph and it's group or scramble them? For me it sometime scrambles them.https://ask.sagemath.org/question/9315/does-sage-keep-the-order-of-vertices-in-a-graph-and-its-group-or-scramble-them-for-me-it-sometime-scrambles-them/I use the Sage automorphism_group function to find the group that leaves an adjacency matric, say C, invariant under a similarity transformation. But sometimes it seems the results are for matrices on a vertex space that is not the same as the original, but is reordered.
A simple example on a 3-vertex graph: o--o--o.
with index order 1 0 2
Adjacency matrix= C =
[0 1 1]
[1 0 0]
[1 0 0]
The group is the identity and a reflection about the center vertex:
[1 0 0] [0 1 0]
[0 1 0] and [1 0 0] = R
[0 0 1] [0 0 1]
I would have expected the reflection to be,
[1 0 0]
[0 0 1]
[0 1 0],
but R is what Sage gives.
Sure enough, RCR^-1 gives the following,
[0 1 0]
[1 0 1]
[0 1 0]
which is *not* the original C matrix. However the R transformation leaves the matrix
[0 0 1]
[0 0 1] = C'
[1 1 0]
invariant. The last matrix is the C matrix where the vertices are indexed in reverse order.
Does Sage have some canonical way it orders the vertices in graphs and groups?
A bit more info, maybe. The order of the irreducible representation table seems to give a hint. If the trivial representation is the first row (which it is for some graphs), it appears (from a few tests) that the vertices retain their original order to align with C. If the trivial representation is the last row then the matrix C' is the adjacency matrix (suggesting a reordering of the vertices). I have no idea why this should be related if it is.
Bottom line for me is I cannot apply any matrices from the group that come from the matrix() method to C or other objects in my original vertex space since they are ordered differently. I don't see how to find the vertex order sage uses. Any help or insight appreciated.
LouChaosWed, 12 Sep 2012 12:20:15 +0200https://ask.sagemath.org/question/9315/drawing irreducible weight representationshttps://ask.sagemath.org/question/9160/drawing-irreducible-weight-representations/Is there a function to draw the weights of an irreducible representation with highest weight ? like the one shown in example 4.2.20 (page 99) from *Thematic Tutorials Release 5.1*?lvogelsteinWed, 18 Jul 2012 12:09:03 +0200https://ask.sagemath.org/question/9160/Specifying cardinality for action of permutation grouphttps://ask.sagemath.org/question/8180/specifying-cardinality-for-action-of-permutation-group/In Magma, it is possible to create a permutation group with something like `G := PermutationGroup<n|relations>,` where $n$ is to be the cardinality of the set the group acts on. One needs this cardinality to use a GModule method. I would like to create such a group in Sage and then port it to Magma to create a GModule, but I always end up with a Magma element having too small a cardinality. Is it possible to specify such a cardinality in Sage? Can it be created as a subgroup of $S_n$? I did not have luck with that.
CodyWed, 22 Jun 2011 02:09:49 +0200https://ask.sagemath.org/question/8180/specific representation for groups inheriting from Sage's Group classhttps://ask.sagemath.org/question/7935/specific-representation-for-groups-inheriting-from-sages-group-class/I am working on designing a class for the group of diagonal symmetries associated with a polynomial singularity. The representation of group elements matters - I want to store a tuple of rationals associated with each group element, and add a bunch of functions that use those values. I'm wondering if there is a way to do this while still inheriting from the Sage Group class (or something that inherits from the Group class).
Thanks!shacsmugglerWed, 09 Feb 2011 20:59:07 +0100https://ask.sagemath.org/question/7935/