Hi Peter, hi Martin,
somehow both approaches I think don't work for me. For example, the square
(m1^2) is carried in both approaches, even though it can be simplified to
m1 in GF(2). I would like sage to account for the GF(2) in order to
simplify terms. For example I would expect that x * (x +
On Wednesday, October 1, 2014 3:30:16 PM UTC-7, Kim Schoener wrote:
Hi Peter, hi Martin,
somehow both approaches I think don't work for me. For example, the square
(m1^2) is carried in both approaches, even though it can be simplified to
m1 in GF(2). I would like sage to account for the
Anything symbolic is in the symbolic ring SR, finite field elements are in
GF(2). You can wrap finite field elements in the symbolic ring if you want
to do symbolic computations with finite field coefficients:
sage: SR(GF(5)(3)) * x
3*x
sage: _ * 2
x
though the symbolic elemnts still don't
I'm not sure I understand fully what you're saying. I did
m1 = SR(GF(2)(1)) * var(m1)
m2 = SR(GF(2)(1)) * var(m2)
m3 = SR(GF(2)(1)) * var(m3)
m4 = SR(GF(2)(1)) * var(m4)
but the Matrix definition
q = Matrix(GF(2), [
[m1, m2],
[m3, m4],
])
still results in the same error: unable to
Your matrix is over GF(2) not over the symbolic ring SR:
sage: m1 = SR(GF(2)(1)) * var(m1)
sage: m2 = SR(GF(2)(1)) * var(m2)
sage: m3 = SR(GF(2)(1)) * var(m3)
sage: m4 = SR(GF(2)(1)) * var(m4)
sage: q = Matrix(SR, [
[m1, m2],
[m3, m4],
])
sage: q^2
[ m1^2 + m2*m3 m1*m2 + m2*m4]
[m1*m3 +
Hello,
I want to do some symbolic operations (matrix/vector) in the GF(2).
Here is an alternative approach (assuming all your expressions are
polynomials in m1, m2, m3 and m4):
sage: R.m1,m2,m3,m4 = PolynomialRing(GF(2))
sage: q = Matrix(R, [[m1, m2], [m3, m4]])
sage: q
[m1 m2]
[m3 m4]
sage: