6-1 �ϯx�}�P��C��

¤@­Ó¯x°} $A$ ªº¤Ï¯x°}¥iªí¥Ü¦¨ $A^{-1}$¡A¥¦¥iº¡¨¬¤U¦C«íµ¥¦¡¡G

$$ \left\{ \begin{matrix} AA^{-1}=I\\ A^{-1}A=I \end{matrix} \right. $$

Hint
  • ¥u¦³¦b $A$ ¬°¤è°}®É¡A$A^{-1}$ ¤~¦s¦b¡C
  • ­Y $A^{-1}$ ¤£¦s¦b¡A«h $A$ ºÙ¬° Singular¡C
  • ª`·N¡G¥»³¹²o¯A³\¦h½u©Ê¥N¼Æªº±M¦³¦Wµü¡C­YµL¡u«H¡B¶®¡B¹F¡v¤§¤¤¤å½Ķ¡A«h¤´¥H­^¤å¦Wµü¬°¥D¡A¥H§Kµü¤£¹F·N¡C

MATLAB ªº inv «ü¥O¥i¥Î©ó­pºâ¤Ï¯x°}¡A¨Ò¦p§Ú­Ì¥i¥H­pºâ¤@­Ó 4x4 ªº Pascal ¤è°}ªº¤Ï¯x°}¡A¨Ã¶i¦æÅçºâ¡A¦p¤U¡G

Example 1: 06-½u©Ê¥N¼Æ/inv01.mA = pascal(4); % ²£¥Í 4x4 ªº Pascal ¤è°} B = inv(A) I1 = A*B I2 = B*A maxDiff=max(max(abs(eye(4)-I1)))B = 4.0000 -6.0000 4.0000 -1.0000 -6.0000 14.0000 -11.0000 3.0000 4.0000 -11.0000 10.0000 -3.0000 -1.0000 3.0000 -3.0000 1.0000 I1 = 1.0000 0 0 0 0 1.0000 0 0 0 0 1.0000 0 -0.0000 -0.0000 0.0000 1.0000 I2 = 1.0000 0 0 -0.0000 0 1.0000 0 -0.0000 0 0 1.0000 0.0000 0 0 0 1.0000 maxDiff = 7.1054e-015

Hint
¥Ñ©ó Pascal ¯x°}ªº¦æ¦C¦¡­È¬° 1¡A¦]¦¹¨ä¤Ï¯x°}¤§¤¸¯À§¡¬°¾ã¼Æ¡C

¥Ñ©ó­pºâ¾÷¤º³¡ªººë·Ç«×¦³­­¡A¦]¦¹ $I1 = A*B$ »P $I2 = B*A$ ³£¤£·|§¹¥þµ¥©ó¤@­Ó³æ¦ì¯x°}¡A¦ý¨ä»~®t¬Û·í¤p¡A»~®t¶q¥i¥Ñ maxDiff = max(max(abs(eye(4)-I1))) ¨Ó­pºâ¡A¤p©ó $10^{-14}$¡C

­Y¯x°} $A$ ¬° Singular ¡]§Y¨ä¤Ï¯x°}¤£¦s¦b¡^¡A«h¦b¨Ï¥Î inv «ü¥O®É¡A·|²£¥Íĵ§i°T®§¡A¨Ò¦p¡G

Example 2: 06-½u©Ê¥N¼Æ/inv02.mA = [1 2 3; 4 5 6; 7 8 9]; B = inv(A){Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.541976e-018.} > In <a href="matlab: opentoline('d:\users\jang\books\matlabProgramming4guru\example\06-½u©Ê¥N¼Æ\inv02.m',2,1)">inv02 at 2</a> In <a href="matlab: opentoline('d:\users\jang\books\goWriteOutputFile.m',75,1)">goWriteOutputFile>dummyFunction at 75</a> In <a href="matlab: opentoline('d:\users\jang\books\goWriteOutputFile.m',52,1)">goWriteOutputFile at 52</a> B = 1.0e+016 * -0.4504 0.9007 -0.4504 0.9007 -1.8014 0.9007 -0.4504 0.9007 -0.4504

Hint
  • ¯x°} A ¬° Singulardet(A)=0

±ý­pºâ¯x°} $A$ ªº¦æ¦C¦¡¡A¥i¥Î det «ü¥O¡AÁ|¨Ò¦p¤U¡G

Example 3: 06-½u©Ê¥N¼Æ/det01.mA = [1 3 4; -3 -4 -1; 2 2 5]; d = det(A)d = 29.0000

¥Ñ Crammer Rule ¥iª¾¯x°} A ªº¦æ¦C¦¡©M¤Ï¯x°}¦³¤U¦CÃö«Y¦¡¡G

$$A^{-1}=\frac{adj(A)}{|A|}$$

¨ä¤¤ $|A|$ ¥Nªí ¢Ï ªº¦æ¦C¦¡¡A$adj(A)$ ¥Nªí $A$ ªº Adjoint Matrix¡A´«¥y¸Ü»¡¡A­Y $A$ ¬°¾ã¼Æ¯x°}¡A«h $|A|$ ­¼¤W $A^{-1}$ ¥²¬°¾ã¼Æ¯x°}¡A¥iÅçµý¦p¤U¡G

Example 4: 06-½u©Ê¥N¼Æ/det02.mA = [1 3 4; -3 -4 -1; 2 2 5]; det(A)*inv(A)ans = -18.0000 -7.0000 13.0000 13.0000 -3.0000 -11.0000 2.0000 4.0000 5.0000

Hint
  • ÁöµM Crammer Rule §Î¦¡¬Û·íºë²¡A¦ý¨Ã¤£¾A¥Î©ó¼Æ­È¹Bºâ¡AMATLAB ¦b­pºâ¤Ï¯x°}®É¡A¨Ã¤£¨Ï¥Î Crammer Rule¡A¦Ó¬O¨Ï¥Î¦UºØ¯x°}¤À¸Ñªº¤èªk¡C

­Y±N inv(A) ¥H¦³²z§Î¦¡¡]Rational Format¡A§Y¤À¤l©M¤À¥À³£¬O¾ã¼Æªº¤À¼Æ¡^¨Óªí¥Ü¡A¥ç¥i¹îı¥X¥¦©M¦æ¦C¦¡ªºÃö«Y¡A¨Ò¦p¡G

Example 5: 06-½u©Ê¥N¼Æ/det03.mA = [1 3 4; -3 -4 -1; 2 2 5]; format rat % ¥H¦³²z§Î¦¡ªí¥Ü¼Æ­È inv(A) format short % §ï¦^¹w³]ªº¼Æ­Èªí¥Ü§Î¦¡ans = -18/29 -7/29 13/29 13/29 -3/29 -11/29 2/29 4/29 5/29

±q³o¸Ì¥i¥H«Ü©úÅ㪺¬Ý¥X¡Ainv(A) ¤¤¨C­Ó¤¸¯Àªº¤À¥À­È¡A´N¬O det(A)¡C


MATLABµ{¦¡³]­p¡G¶i¶¥½g