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.Thu, 11 Feb 2021 18:59:45 +0100Mapping isomorphism for posets or graphshttps://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/I know that we can check if two posets/graphs are isomorphic using is_isomorphic(), but is there any way that I can get Sage to output a possible mapping between the two posets/graphs that are isomorphic?sunflowerThu, 11 Feb 2021 18:59:45 +0100https://ask.sagemath.org/question/55675/20 monomials of degree 3 in 4 variables in lexicographic orderinghttps://ask.sagemath.org/question/50082/20-monomials-of-degree-3-in-4-variables-in-lexicographic-ordering/ Hey community,
I've recently wanted to switch over to sage (very new) from Maple and I am having trouble understanding how to make monomials of degree 3 in 4 variables (hopefully in lexographic ordering think of the w coordinate as one). I am not very good at english, but this is for a Clebsch map up and down for a surface that I am studying.
These are the maps:
m1:=p-->p[1]^3;
m2:=p-->p[1]^2*p;
m3:=p-->p[1]^2*p[3];
m4:=p-->p[1]^2;
m5:=p-->p[1]*p[2]^2;
m6:=p-->p[1]*p[2]*p[3];
m7:=p-->p[1]*p[2];
m8:=p-->p[1]*p[3]^2;
m9:=p-->p[1]*p[3];
m10:=p-->p[1];
m11:=p-->p[2]^3;
m12:=p-->p[2]^2*p[3];
m13:=p-->p[2]^2;
m14:=p-->p[2]*p[3]^2;
m15:=p-->p[2]*p[3];
m16:=p-->p[2];
m17:=p-->p[3]^3;
m18:=p-->p[3]^2;
m19:=p-->p[3];
m20:=p-->1;
Then M:=[m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20]bllooiWed, 26 Feb 2020 22:41:38 +0100https://ask.sagemath.org/question/50082/Mapping 2-dimensional matrix index to a listhttps://ask.sagemath.org/question/45436/mapping-2-dimensional-matrix-index-to-a-list/Hi all,
I have a following matrix:
mat = matrix([[1,5,7],[3,10,12],[0,5,3]])
[ 1 5 7]
[ 3 10 12]
[ 0 5 3]
I got 3 parts from the matrix:
A = mat[[0,1,2],[0]]
[1]
[3]
[0]
B = mat[[1,2],[1,2]]
[10 12]
[ 5 3]
C = mat[[0],[1,2]]
[5 7]
To know that these 3 parts are not overlapping to each other, I have an idea to map the original matrix to 1-dimension array as IDs for each cell:
tt = copy(mat)
row = mat.nrows()
col = mat.ncols()
for x in range(row):
for y in range(col):
tt[x,y] = x*col+y
sage: tt
[0 1 2]
[3 4 5]
[6 7 8]
Then again I go over all coordinate that I took for A, B and C to collect these mapped ID.
Regarding to A,
cells_A = []
for i in range(0, 3):
for j in range(0, 1):
cells_A.append(tt[i, j])
sage: cells_A
[0, 3, 6]
Regarding to B:
cells_B = []
for i in range(1, 3):
for j in range(1, 3):
cells_B.append(tt[i, j])
sage: cells_B
[4, 5, 7, 8]
Regarding to C, similarly we have:
sage: cells_C = [1,2]
If size of union from these 3 cells is equal to the total size of A, B, and C, then I conclude no overlapping among them.
area = sum([A.nrows()*A.ncols(), B.nrows()*B.ncols(), C.nrows()*C.ncols()])
if len(set.union(*[set(cells_A), set(cells_B), set(cells_C)])) == area:
print("No overlapping parts")
However, this way requires lots of work and **SLOW**. Is there any already SageMath's Matrix feature supporting some steps above, especially a way to improve/avoid mapping index?imnvshWed, 13 Feb 2019 01:54:13 +0100https://ask.sagemath.org/question/45436/How to defining a twist on an elliptic curvehttps://ask.sagemath.org/question/39597/how-to-defining-a-twist-on-an-elliptic-curve/Hey,
I would like to do map points of the ellitptic curve $E(\mathbb F_{p^{k}})$ to its twist. I am able to define the twist on a mathematical way, but it returns always errors. I will give you a M(n)WE:
Aim: Get a generator of a r-torsion subgroup of E, lift that to E16 and twist it down to E4, to get a r-torsion subgroup-generator of E4.
#MWE
## Mathematical definition:
$E(\mathbb F_{p^{16}}): y^2=x^3+x$ and its quartic twist $E'(\mathbb F_{p^4}): y^2=x^3+2^{-1/4}x$. The point mapping is defined as $\psi: E\to E', (x,y,z)\mapsto (2^{-1/2}x, 2^{-3/4}y, z)$.
## Define the fields and curves
p= 13
r=5
R=GF(p)
_.<x> = PolynomialRing(R)
R4.<x> = R.extension(x^4 - 2, 'x')
_.<y> = PolynomialRing(R)
R16.<y> = R.extension(y^16 -2, 'y')
_.<z> = PolynomialRing(R4)
R16_over_R4.<z> = R4.extension(z^4-x, 'z')
E = EllipticCurve(R, [1,0]) # y^2 = x^3+x
E4 = EllipticCurve(R4, [x,0])
E16 = EllipticCurve(R16, [1,0])
## Defining the point and pre-computations
k= ZZ(E.order()/r) # since E.order()*P = (0:1:0), we can trick with that
b=R16(2^(-1)); b= sqrt(sqrt(2)) #the twisting parameter, that is a square in R4 and R16
P= E.gens()[0]
Q=k*P # check if Q != E((0,1,0)), if yes its a r-torsion point.
Q16 = E16(Q) #raise Q
## The not working twist
#twist
E4( (Q16[0]*b^2, Q16[1]*b^3))
Sage is able to compute the quartic twist of its own, but I do not recieve the right twist, that I had computed by hand ( $E'$ ). Using
E4.quartic_twist(v^-1)ShalecThu, 16 Nov 2017 11:43:57 +0100https://ask.sagemath.org/question/39597/Is it better practice to show SAGE code on a web use of SAGE?https://ask.sagemath.org/question/10305/is-it-better-practice-to-show-sage-code-on-a-web-use-of-sage/If you go to my page for The Sensible Calculus Book http://users.humboldt.edu/flashman/senscalca_x.html you will find how I've added SAGE to this page- with interacts for graphs, direction fields and Euler's Method for DE's as well as one of the mapping diagram interacts I am developing from the assistance of Jeff Denny, Jason Grout, and others at Sage Edu Days 5 . I would like feedback on this if you have suggestions- I have currently hidden the code from the users using the interact buttons. Is it better practice to show the Sage code?Martin FlashmanMon, 01 Jul 2013 13:27:00 +0200https://ask.sagemath.org/question/10305/Is there some way to have Geogebra and SAGE interact?https://ask.sagemath.org/question/10306/is-there-some-way-to-have-geogebra-and-sage-interact/ On my page for [The Sensible Calculus Book](http://users.humboldt.edu/flashman/senscalca_x.html) you will find how I've added SAGE to this page- with interacts for graphs and one of the mapping diagram interacts I am developing from the assistance of Jeff Denny, Jason Grout, and others at Sage 5 Edu.
ALSO- I have a new demo using Geogebra on the same page to do similar things with graphs and mapping diagrams dynamically. Is there some way to have Geogebra and SAGE interact? Martin FlashmanMon, 01 Jul 2013 13:32:41 +0200https://ask.sagemath.org/question/10306/