Ask Your Question

Revision history [back]

I think you just put things in the wrong order.

I am guessing you want to achieve something like the following.

Here I'm using a random matrix and a random vector.

sage: A = random_matrix(ZZ, 5) sage: A [ 22 0 -128 1 -1] [ 0 -3 -1 -1 1] [ 1 -1 -1 1 0] [ 3 -4 2 25 0] [ 3 32 1 2 -1] sage: B = random_vector(ZZ, 5) sage: B (1, -5, 0, 1, 14)

Multiply them.

sage: A * B (9, 28, 7, 48, -169)

And use the result to define a, b, c, d, e.

sage: a, b, c, d, e = A * B sage: a, b, c, d, e (9, 28, 7, 48, -169) sage: b 28 sage: e -169

I think you just put things in the wrong order.

I am guessing you want to achieve something like the following.

Here I'm using a random matrix and a random vector.

sage: A = random_matrix(ZZ, 5)
sage: A
[  22    0 -128    1   -1]
[   0   -3   -1   -1    1]
[   1   -1   -1    1    0]
[   3   -4    2   25    0]
[   3   32    1    2   -1]
sage: B = random_vector(ZZ, 5)
sage: B
(1, -5, 0, 1, 14)

Multiply them.

14)

Here is their product.

sage: A * B
(9, 28, 7, 48, -169)

And use the result to define -169)

Define a, b, c, d, e.

e to be the entries of this product.

sage: a, b, c, d, e = A * B
sage: a, b, c, d, e
(9, 28, 7, 48, -169)
sage: b
28
sage: e
-169

-169