ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 19 Sep 2019 09:54:30 -0500Elements of finitely presented modulehttp://ask.sagemath.org/question/47977/elements-of-finitely-presented-module/Hello everyone,
I am computing group homology and have to deal with huge boundary matrices. The result should be a finitely presented Z-module. But I got the following problem
M = Matrix(ZZ,3,[2,1,0,0,0,0,0,0,0])
V = M.left_kernel()
N = Matrix(ZZ,2,[0,2,2,0,0,0])
W = N.image()
Q = V/W
Q.0
Then I got the warning
"repr(sage.modules.fg_pid.fgp_module.FGP_Module_class_with_category.element_class at 0x7ff4aad554b0) failed: AttributeError: 'sage.matrix.matrix_integer_sparse.Matrix_integer_sparse' object has no attribute '_clear_denom'
Do you have any idea how I can get through this? I want to know information about the generators of Q.
I can't even ask for its additive order
x = Q.0
x.additive_order()
Thank you!Tuan BuiThu, 19 Sep 2019 09:54:30 -0500http://ask.sagemath.org/question/47977/How to solve this system of equation in sage?http://ask.sagemath.org/question/44988/how-to-solve-this-system-of-equation-in-sage/How to solve this system of equations in sage?
$x_1+l_1x_2+l_1^2x_3+\dots+l_1^{k-1}x_k=c_1+r $.
$x_1+l_2x_2+l_2^2x_3+\dots+l_2^{k-1}x_k=c_2+r^2$
$\dots $
$x_1+l_kx_2+l_k^2x_3+\dots+l_k^{k-1}x_k=c_k+r^k$
where $l_i$'s are different positive integers and $c_i,r$ are integers in $[0,256]$
In particular, we can solve with sage. Here is the code :
a0, a1,a2,b3,b4, b5,r,l1,l2,l3 = var('a0,a1,a2,b3,b4,b5, r,l1,l2,l3')
X=solve([a0+l1*a1+l1^2*a2==b3+r^3, a0+l2*a1+l2^2*a2==b4+r^2,a0+l3*a1+l3^2*a2==b5+r^1], a0,a1, a2)MKSThu, 10 Jan 2019 11:31:02 -0600http://ask.sagemath.org/question/44988/how to extract a common factor of vector componentshttp://ask.sagemath.org/question/42784/how-to-extract-a-common-factor-of-vector-components/ v=vec([a*x,a*y])
# should give
a*vec([x,y])
# by a command. Which command?rewolfSat, 30 Jun 2018 06:18:38 -0500http://ask.sagemath.org/question/42784/Gram-Schmidt with arbitrary inner product?http://ask.sagemath.org/question/40123/gram-schmidt-with-arbitrary-inner-product/ Hi,
I'd like to find an orthonormal basis of polynomials using an arbitrary inner product. I know how to do this in Maxima:
ip(f, g) := integrate(f * g, x, -1, 1); /* for example */
y : gramschmidt([1, x, x^2], ip);
But is there a nice way to do this in sage?
Thanks!
-Andrew
ElpimientoTue, 12 Dec 2017 03:48:50 -0600http://ask.sagemath.org/question/40123/Eigenvalues of hecke operatorshttp://ask.sagemath.org/question/40588/eigenvalues-of-hecke-operators/For a project I am trying to build a program that computes a basis for cusp forms of weight 2 over $\Gamma_0(N)$. At one point, I want to represent eigenvalues of multiple Hecke operators. For example, (for $N=23$) I have found the following matrices for the Hecke operators:
$
T_2=\begin{pmatrix} -2 & -1/2 ;
2 & 1 \end{pmatrix}, T_3=\begin{pmatrix} 3 & 1 ;
-4 & -3 \end{pmatrix} \quad T_5=\begin{pmatrix} -2 & -1/2 ;
2 & 1 \end{pmatrix} \quad
$
so we have the following characteristic polynomials $f_2=x^2+x-1$, $f_3=x^2-5$, $f_5=x^2 +2x-4$. Suppose we denote the solution of $f_2$ (eigenvalues of $T_2$) by $a$ and it's conjugate. Then we can denote the solution of $f_3$ by $2a+1$ and of $f_5$ by $2a$.
I am trying to figure out how I can 'make' Sage represent these eigenvalues in this way. Say I have found these matrices above, I can create k.< a >=NumberField(x^2+x-1), then $a$ represents the root of the polynomial. So the question for me is, how can I make Sage give me the eigenvalues of $T_3$ and $T_5$ in terms of $a$?
Furthermore, I am wondering how to get the jordan normal form of $T_2$, or eigenmatrix in terms of $a$. If I ask for jordan_form, I get an error, and if I ask for eigenmatrix_right, I only get a numerical expression.
Remark: A little context, the goal for this project is to represent newforms in a similar way as Sage does, when you ask for example Newforms(23,2,names='a'). We need the eigenvalues of the hecke operators since they correspond with the coefficients of the Fourier series.
----------TheBeiramSat, 13 Jan 2018 04:32:29 -0600http://ask.sagemath.org/question/40588/Rounding entries of a random vectorhttp://ask.sagemath.org/question/39697/rounding-entries-of-a-random-vector/Hello,
I am trying to generate a random diagonal matrix, defined by a random vector over a field RR. The problem is that I need to round all the values to two decimal places, make entries evenly positive and negative (not necessary of equal amount) and, ideally, avoid zeroes.
I have a code
`[round(4*random()-2,2)for i in[1 .. 8]]`
that produces a list of values that I need of size 8. However, I am struggling to combine it with a command `diagonal_matrix` and insert it there.
Also, I don't really understand why do we need to multiply it by 4 in here
`[round(4*random()-2,2)for i in[1 .. 8]]`
and why it produces negative values only, if I multiply it by 2 instead of 4. Could someone explain it please?
Is there any other simpler and more elegant way to solve this problem? Thank you.XeniaTue, 21 Nov 2017 07:53:11 -0600http://ask.sagemath.org/question/39697/