5151def lyap (A ,Q ,C = None ,E = None ):
5252 """ X = lyap(A,Q) solves the continuous-time Lyapunov equation
5353
54- A X + X A^T + Q = 0
54+ :math:` A X + X A^T + Q = 0`
5555
5656 where A and Q are square matrices of the same dimension.
5757 Further, Q must be symmetric.
5858
5959 X = lyap(A,Q,C) solves the Sylvester equation
6060
61- A X + X Q + C = 0
61+ :math:` A X + X Q + C = 0`
6262
6363 where A and Q are square matrices.
6464
6565 X = lyap(A,Q,None,E) solves the generalized continuous-time
6666 Lyapunov equation
6767
68- A X E^T + E X A^T + Q = 0
68+ :math:` A X E^T + E X A^T + Q = 0`
6969
7070 where Q is a symmetric matrix and A, Q and E are square matrices
7171 of the same dimension. """
@@ -88,10 +88,10 @@ def lyap(A,Q,C=None,E=None):
8888 if len (shape (Q )) == 1 :
8989 Q = Q .reshape (1 ,Q .size )
9090
91- if C != None and len (shape (C )) == 1 :
91+ if C is not None and len (shape (C )) == 1 :
9292 C = C .reshape (1 ,C .size )
9393
94- if E != None and len (shape (E )) == 1 :
94+ if E is not None and len (shape (E )) == 1 :
9595 E = E .reshape (1 ,E .size )
9696
9797 # Determine main dimensions
@@ -106,7 +106,7 @@ def lyap(A,Q,C=None,E=None):
106106 m = size (Q ,0 )
107107
108108 # Solve standard Lyapunov equation
109- if C == None and E == None :
109+ if C is None and E is None :
110110 # Check input data for consistency
111111 if shape (A ) != shape (Q ):
112112 raise ControlArgument ("A and Q must be matrices of identical \
@@ -139,7 +139,7 @@ def lyap(A,Q,C=None,E=None):
139139 raise e
140140
141141 # Solve the Sylvester equation
142- elif C != None and E == None :
142+ elif C is not None and E is None :
143143 # Check input data for consistency
144144 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
145145 raise ControlArgument ("A must be a quadratic matrix." )
@@ -170,7 +170,7 @@ def lyap(A,Q,C=None,E=None):
170170 raise e
171171
172172 # Solve the generalized Lyapunov equation
173- elif C == None and E != None :
173+ elif C is None and E is not None :
174174 # Check input data for consistency
175175 if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
176176 (size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -233,21 +233,21 @@ def lyap(A,Q,C=None,E=None):
233233def dlyap (A ,Q ,C = None ,E = None ):
234234 """ dlyap(A,Q) solves the discrete-time Lyapunov equation
235235
236- A X A^T - X + Q = 0
236+ :math:` A X A^T - X + Q = 0`
237237
238238 where A and Q are square matrices of the same dimension. Further
239239 Q must be symmetric.
240240
241241 dlyap(A,Q,C) solves the Sylvester equation
242242
243- A X Q^T - X + C = 0
243+ :math:` A X Q^T - X + C = 0`
244244
245245 where A and Q are square matrices.
246246
247247 dlyap(A,Q,None,E) solves the generalized discrete-time Lyapunov
248248 equation
249249
250- A X A^T - E X E^T + Q = 0
250+ :math:` A X A^T - E X E^T + Q = 0`
251251
252252 where Q is a symmetric matrix and A, Q and E are square matrices
253253 of the same dimension. """
@@ -275,10 +275,10 @@ def dlyap(A,Q,C=None,E=None):
275275 if len (shape (Q )) == 1 :
276276 Q = Q .reshape (1 ,Q .size )
277277
278- if C != None and len (shape (C )) == 1 :
278+ if C is not None and len (shape (C )) == 1 :
279279 C = C .reshape (1 ,C .size )
280280
281- if E != None and len (shape (E )) == 1 :
281+ if E is not None and len (shape (E )) == 1 :
282282 E = E .reshape (1 ,E .size )
283283
284284 # Determine main dimensions
@@ -293,7 +293,7 @@ def dlyap(A,Q,C=None,E=None):
293293 m = size (Q ,0 )
294294
295295 # Solve standard Lyapunov equation
296- if C == None and E == None :
296+ if C is None and E is None :
297297 # Check input data for consistency
298298 if shape (A ) != shape (Q ):
299299 raise ControlArgument ("A and Q must be matrices of identical \
@@ -322,7 +322,7 @@ def dlyap(A,Q,C=None,E=None):
322322 raise e
323323
324324 # Solve the Sylvester equation
325- elif C != None and E == None :
325+ elif C is not None and E is None :
326326 # Check input data for consistency
327327 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
328328 raise ControlArgument ("A must be a quadratic matrix" )
@@ -353,7 +353,7 @@ def dlyap(A,Q,C=None,E=None):
353353 raise e
354354
355355 # Solve the generalized Lyapunov equation
356- elif C == None and E != None :
356+ elif C is None and E is not None :
357357 # Check input data for consistency
358358 if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
359359 (size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -414,7 +414,7 @@ def care(A,B,Q,R=None,S=None,E=None):
414414 """ (X,L,G) = care(A,B,Q,R=None) solves the continuous-time algebraic Riccati
415415 equation
416416
417- A^T X + X A - X B R^-1 B^T X + Q = 0
417+ :math:` A^T X + X A - X B R^{-1} B^T X + Q = 0`
418418
419419 where A and Q are square matrices of the same dimension. Further,
420420 Q and R are a symmetric matrices. If R is None, it is set to the
@@ -425,7 +425,7 @@ def care(A,B,Q,R=None,S=None,E=None):
425425 (X,L,G) = care(A,B,Q,R,S,E) solves the generalized continuous-time
426426 algebraic Riccati equation
427427
428- A^T X E + E^T X A - (E^T X B + S) R^-1 (B^T X E + S^T) + Q = 0
428+ :math:` A^T X E + E^T X A - (E^T X B + S) R^{-1} (B^T X E + S^T) + Q = 0`
429429
430430 where A, Q and E are square matrices of the same
431431 dimension. Further, Q and R are symmetric matrices. If R is None,
@@ -460,13 +460,13 @@ def care(A,B,Q,R=None,S=None,E=None):
460460 if len (shape (Q )) == 1 :
461461 Q = Q .reshape (1 ,Q .size )
462462
463- if R != None and len (shape (R )) == 1 :
463+ if R is not None and len (shape (R )) == 1 :
464464 R = R .reshape (1 ,R .size )
465465
466- if S != None and len (shape (S )) == 1 :
466+ if S is not None and len (shape (S )) == 1 :
467467 S = S .reshape (1 ,S .size )
468468
469- if E != None and len (shape (E )) == 1 :
469+ if E is not None and len (shape (E )) == 1 :
470470 E = E .reshape (1 ,E .size )
471471
472472 # Determine main dimensions
@@ -479,11 +479,11 @@ def care(A,B,Q,R=None,S=None,E=None):
479479 m = 1
480480 else :
481481 m = size (B ,1 )
482- if R == None :
482+ if R is None :
483483 R = eye (m ,m )
484484
485485 # Solve the standard algebraic Riccati equation
486- if S == None and E == None :
486+ if S is None and E is None :
487487 # Check input data for consistency
488488 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
489489 raise ControlArgument ("A must be a quadratic matrix." )
@@ -564,7 +564,7 @@ def care(A,B,Q,R=None,S=None,E=None):
564564 return (X , w [:n ] , G )
565565
566566 # Solve the generalized algebraic Riccati equation
567- elif S != None and E != None :
567+ elif S is not None and E is not None :
568568 # Check input data for consistency
569569 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
570570 raise ControlArgument ("A must be a quadratic matrix." )
@@ -674,7 +674,7 @@ def dare(A,B,Q,R,S=None,E=None):
674674 """ (X,L,G) = dare(A,B,Q,R) solves the discrete-time algebraic Riccati
675675 equation
676676
677- A^T X A - X - A^T X B (B^T X B + R)^-1 B^T X A + Q = 0
677+ :math:` A^T X A - X - A^T X B (B^T X B + R)^{-1} B^T X A + Q = 0`
678678
679679 where A and Q are square matrices of the same dimension. Further, Q
680680 is a symmetric matrix. The function returns the solution X, the gain
@@ -684,12 +684,11 @@ def dare(A,B,Q,R,S=None,E=None):
684684 (X,L,G) = dare(A,B,Q,R,S,E) solves the generalized discrete-time algebraic
685685 Riccati equation
686686
687- A^T X A - E^T X E - (A^T X B + S) (B^T X B + R)^-1 (B^T X A + S^T) +
688- + Q = 0
687+ :math:`A^T X A - E^T X E - (A^T X B + S) (B^T X B + R)^{-1} (B^T X A + S^T) + Q = 0`
689688
690689 where A, Q and E are square matrices of the same dimension. Further, Q and
691690 R are symmetric matrices. The function returns the solution X, the gain
692- matrix G = (B^T X B + R)^-1 (B^T X A + S^T) and the closed loop
691+ matrix :math:` G = (B^T X B + R)^{-1} (B^T X A + S^T)` and the closed loop
693692 eigenvalues L, i.e., the eigenvalues of A - B G , E.
694693 """
695694 if S is not None or E is not None :
@@ -730,13 +729,13 @@ def dare_old(A,B,Q,R,S=None,E=None):
730729 if len (shape (Q )) == 1 :
731730 Q = Q .reshape (1 ,Q .size )
732731
733- if R != None and len (shape (R )) == 1 :
732+ if R is not None and len (shape (R )) == 1 :
734733 R = R .reshape (1 ,R .size )
735734
736- if S != None and len (shape (S )) == 1 :
735+ if S is not None and len (shape (S )) == 1 :
737736 S = S .reshape (1 ,S .size )
738737
739- if E != None and len (shape (E )) == 1 :
738+ if E is not None and len (shape (E )) == 1 :
740739 E = E .reshape (1 ,E .size )
741740
742741 # Determine main dimensions
@@ -751,7 +750,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
751750 m = size (B ,1 )
752751
753752 # Solve the standard algebraic Riccati equation
754- if S == None and E == None :
753+ if S is None and E is None :
755754 # Check input data for consistency
756755 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
757756 raise ControlArgument ("A must be a quadratic matrix." )
@@ -835,7 +834,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
835834 return (X , w [:n ] , G )
836835
837836 # Solve the generalized algebraic Riccati equation
838- elif S != None and E != None :
837+ elif S is not None and E is not None :
839838 # Check input data for consistency
840839 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
841840 raise ControlArgument ("A must be a quadratic matrix." )
0 commit comments