Skip to content

Instantly share code, notes, and snippets.

@RobertTalbert
Created February 15, 2023 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertTalbert/1ca88362aa812df708d3eb8a05f6a684 to your computer and use it in GitHub Desktop.
Save RobertTalbert/1ca88362aa812df708d3eb8a05f6a684 to your computer and use it in GitHub Desktop.
from sympy import *
def niceEigs(e1,e2):
M = Matrix([[e1,0],[0,e2]])
P = randMatrix(2,2,-3,3)
while P.det() == 0:
# Change the -3 and 3 if you want more variety in the entries
P = randMatrix(2,2,-3,3)
return P*M*P.inv()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment