@@ -39,11 +39,16 @@ def eigdemo(A):
39
39
plt .ylim (- s , s )
40
40
ax .set_aspect ('equal' )
41
41
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
44
44
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
+
46
48
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" )
47
52
48
53
def animate (theta ):
49
54
@@ -68,10 +73,13 @@ def animate(theta):
68
73
def main ():
69
74
70
75
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]" )
73
78
sys .exit (0 )
74
-
79
+
80
+ if sys .argv in ("-h" , "--help" , "help" ):
81
+ help ()
82
+
75
83
if len (sys .argv ) == 5 :
76
84
77
85
try :
@@ -80,15 +88,16 @@ def help():
80
88
except :
81
89
help ()
82
90
83
- elif sys .argv == 1 :
91
+ elif len ( sys .argv ) == 1 :
84
92
A = np .array ([
85
93
[1 , 2 ],
86
94
[3 , 3 ]
87
95
])
88
-
96
+
89
97
else :
90
98
help ()
91
99
100
+
92
101
eigdemo (A )
93
102
94
103
if __name__ == "__main__" :
0 commit comments