@@ -39,11 +39,16 @@ def eigdemo(A):
3939 plt .ylim (- s , s )
4040 ax .set_aspect ('equal' )
4141
42- l1 , = plt .plot ([0 , 0 ], [0 , 0 ], color = 'r' , linewidth = 1.5 ) # input vector
43- l2 , = plt .plot ([0 , 0 ], [0 , 0 ], color = 'b' , linewidth = 1.5 ) # transformed vector
42+ l1 , = plt .plot ([0 , 0 ], [0 , 0 ], color = 'r' , linewidth = 3 ) # input vector
43+ l2 , = plt .plot ([0 , 0 ], [0 , 0 ], color = 'b' , linewidth = 3 ) # transformed vector
4444
45- plt .legend (['$x$' , r'${\bf A} x$' ])
45+ plt .plot ([0 , x [0 , 0 ]], [0 , x [1 , 0 ]], color = 'k' , linewidth = 1 )
46+ plt .plot ([0 , x [0 , 1 ]], [0 , x [1 , 1 ]], color = 'k' , linewidth = 1 )
47+
4648
49+ plt .legend (['$x$' , r'${\bf A} x$' , r'$x_1$' , r'$x_2$' ])
50+
51+ print ("\n to exit: type q, or close the window" )
4752
4853 def animate (theta ):
4954
@@ -68,10 +73,13 @@ def animate(theta):
6873def main ():
6974
7075 def help ():
71- print ("eigdemo uses default matrix [1 2; 3 4]" )
72- print ("eigdemo a b c d uses matrix [a b; c d]" )
76+ print ("eigdemo # uses default matrix [1 2; 3 4]" )
77+ print ("eigdemo a b c d # uses matrix [a b; c d]" )
7378 sys .exit (0 )
74-
79+
80+ if sys .argv in ("-h" , "--help" , "help" ):
81+ help ()
82+
7583 if len (sys .argv ) == 5 :
7684
7785 try :
@@ -80,15 +88,16 @@ def help():
8088 except :
8189 help ()
8290
83- elif sys .argv == 1 :
91+ elif len ( sys .argv ) == 1 :
8492 A = np .array ([
8593 [1 , 2 ],
8694 [3 , 3 ]
8795 ])
88-
96+
8997 else :
9098 help ()
9199
100+
92101 eigdemo (A )
93102
94103if __name__ == "__main__" :
0 commit comments