Ask Your Question
0

How to create a matrix of same entries?

asked 8 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

For example, I want to make a 20 by 20 matrix with all entries being 10. Is there a quick command for that? Thanks!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

slelievre gravatar image

This is one way.

sage: matrix(ZZ, 4, 4, lambda i, j: 10)
[10 10 10 10]
[10 10 10 10]
[10 10 10 10]
[10 10 10 10]
Preview: (hide)
link

Comments

Thank you! This is what I was looking for.

Lisewe gravatar imageLisewe ( 8 years ago )

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 8 years ago

Seen: 734 times

Last updated: Nov 29 '16