ex4_12.m
来自「Advanced Engineering Mathematics using M」· M 代码 · 共 22 行
M
22 行
% EX4_12.M Demonstrate Caley-Hamilton theorem% as in Example 4.12 for A^2-(a+d)*A+(ad-bc)*I=0.% (This requires the Symbolic Math Toolbox)%fprintf('Test of Caley-Hamilton theorem \n')A=sym('[a,b;c,d]') % General 2x2 matrixI=sym('[1,0;0,1]'); % Identityc1='a+d';c2='a*d-b*c';Aconst=sym(c2)*sym(I); % Compute constant termAlin=sym(c1)*sym(A); % Linear termAsq=sym(A)^2; % A^2R1=sym(Aconst)-sym(Alin); % Sum the termsR2=sym(Asq)+sym(R1);% fprintf('Strike a key to continue \n')pausefprintf('Result = A^2-(a+d)*A+(ad-bc)*I =0? \n')Result=simplify(R2)%% Version 5 Replaced symmul, etc.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?