Ask Your Question
0

Plotting eigenvalues in complex plane

asked 2020-04-17 17:58:31 -0500

salam gravatar image

Would you please tell how I can define a random matrix whose entries are 1, 0 and plot its eigenvalues in the complex plane?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2020-04-18 03:43:11 -0500

vdelecroix gravatar image

can do

sage: point2d(random_matrix(ZZ, 10, 10, x=0, y=2).charpoly().roots(CDF, False))
edit flag offensive delete link more

Comments

Increasing the size of the points looks even better:

point2d(random_matrix(ZZ, 10, 10, x=0, y=2).charpoly().roots(CDF, False), size=50)
Sébastien gravatar imageSébastien ( 2020-04-18 04:41:03 -0500 )edit

@vdelecroix Thanks, if I want to do this for several times, I checked the following code, but it didn't work

for i in range(5):
point2d(random_matrix(ZZ, 10, 10, x=0, y=2).charpoly().roots(CDF, False), size=50)

Is it correct?

salam gravatar imagesalam ( 2020-04-18 05:06:14 -0500 )edit

@Sébastien that depends on the size of the matrix.

@salam: if the code would have been correct it would run. Just learn how to make a loop in Python. But to get several pictures, it might be more convenient to use graphics_array.

vdelecroix gravatar imagevdelecroix ( 2020-04-18 06:14:32 -0500 )edit

Thank you.

salam gravatar imagesalam ( 2020-04-18 06:44:49 -0500 )edit

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: 2020-04-17 17:58:31 -0500

Seen: 49 times

Last updated: Apr 18