1 | initial version |
I suppose you are working modulo 101.
Compare the following.
For reference I am working with:
sage: version()
'SageMath version 7.4, Release Date: 2016-10-18'
Using plain integers.
sage: a1 = vector((76, 83))
sage: b1 = 62
sage: x1, x2 = SR.var('x1 x2')
sage: x = vector((x1, x2))
sage: b1 - a1.dot_product(x)
-76*x1 - 83*x2 + 62
sage: b1 + a1.dot_product(x)
76*x1 + 83*x2 + 62
Using integers modulo 101.
sage: R = Zmod(101)
sage: a1 = vector(R, (76, 83))
sage: b1 = R(62)
sage: x1, x2 = SR.var('x1 x2')
sage: x = vector((x1, x2))
sage: b1 - a1.dot_product(x)
25*x1 + 18*x2 + 62
sage: b1 + a1.dot_product(x)
76*x1 + 83*x2 + 62
2 | No.2 Revision |
I suppose you are working modulo 101.
Compare the following.
For reference I am working with:
sage: version()
'SageMath version 7.4, Release Date: 2016-10-18'
Using plain integers.
sage: a1 = vector((76, 83))
sage: b1 = 62
sage: x1, x2 = SR.var('x1 x2')
sage: x = vector((x1, x2))
sage: b1 - a1.dot_product(x)
-76*x1 - 83*x2 + 62
sage: b1 + a1.dot_product(x)
76*x1 + 83*x2 + 62
Using integers modulo 101.
sage: R = Zmod(101)
sage: a1 = vector(R, (76, 83))
sage: b1 = R(62)
sage: x1, x2 = SR.var('x1 x2')
sage: x = vector((x1, x2))
sage: b1 - a1.dot_product(x)
25*x1 + 18*x2 + 62
sage: b1 + a1.dot_product(x)
76*x1 + 83*x2 + 62
If you get a1
and b1
as above, or from another function and they are defined modulo 101,
you can change ring as follows.
sage: a1 = a1.change_ring(ZZ)
sage: b1 = ZZ(b1)
Then this works as expected:
sage: b1 - a1.dot_product(x)
-76*x1 - 83*x2 + 62