# How to create a matrix of same entries?

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

How to create a matrix of same entries?

asked
**
2016-11-29 15:26:27 -0600
**

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!

add a comment

1

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]
```

Asked: **
2016-11-29 15:26:27 -0600
**

Seen: **42 times**

Last updated: **Nov 29 '16**

How to calculate sine of a matrix

How to build a matrix thought of as an array of smaller matrices?

Random positive definite matrix

Map a function to each element of a matrix?

Get a matrix to display answers as decimals/floats, not fraction?

How to get the coefficient of $x^n$ in symbolic expression of matrix

Why can't I find exponential of a "complex256" matrix?

How can I plot matrices from Database into different sage cells?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.