Ask Your Question
0

How to record entries from a matrix (or vector)?

asked 2016-11-29 23:29:35 +0100

anonymous user

Anonymous

updated 2016-11-29 23:29:51 +0100

For example, I have A*B = (a,b,c,d,e) But I have to manually write down a = blah blah, b = blah blah, c = blah blah.... I tried the same method with list, but apparently it didn't work on a vector. Thanks!

edit retag flag offensive close merge delete

Comments

It is not entirely clear what your are asking. Could you please be more specific? What does the product A*B have to do with the question?

fidbc gravatar imagefidbc ( 2016-11-29 23:48:23 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-30 05:31:22 +0100

slelievre gravatar image

updated 2016-11-30 05:32:40 +0100

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)

Here is their product.

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

Define a, b, c, d, 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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-29 23:29:35 +0100

Seen: 233 times

Last updated: Nov 30 '16