一种多项式矩阵列既约分析方法汇总.docx
- 文档编号:8288071
- 上传时间:2023-01-30
- 格式:DOCX
- 页数:17
- 大小:86.40KB
一种多项式矩阵列既约分析方法汇总.docx
《一种多项式矩阵列既约分析方法汇总.docx》由会员分享,可在线阅读,更多相关《一种多项式矩阵列既约分析方法汇总.docx(17页珍藏版)》请在冰豆网上搜索。
一种多项式矩阵列既约分析方法汇总
一种多项式矩阵列既约分析方法
一、目的与用途
在多项式矩阵分析中,矩阵的既约性是一个很重要的问题,本文介绍了针对pXp阶多项式矩阵M(s)的分析方法,并给出了确定其是否列既约的计算机程序。
经过输入处理也可实现行既约的分析。
二、数学原理
给定一个pXp的非奇异多项式矩阵M(s)称为是列既约的,如果满足下述条件
p
degdetM(s)=∑δi=1ciM(s)
用程序实现时,要先定义一二维数组W[x][x]存放多项式矩阵,矩阵元素为一维整型数组类型,存放多项式的系数和首项次数。
通过键盘输入多项式,对所输入的多项式进行分析处理,得到二维数组w[x][x],每个多项式对应一个一维数组。
根据每个多项式对应的一维数组,得到该多项式的最高指数。
通过对二维数组w[x][x]的搜索,得到每一列最高指数的
p
最大值。
然后对所得到的最高指数的最大值分别按列进行累加,得到∑δi=1ciM(s)。
其次,求出二维数组w[x][x]所对应的多项式矩阵的行列式的值,即detM(s),detM(s)=∑(-1)ai
1p1a2p2a3p3a4p4...anpn,其中p1p2p3p4…pn为从1到n所有整数的某
detM(s),然种排列结果,i为p1p2p3p4…pn的逆序数。
找出该多项式的最高指数deg
p
后与前面所得到的∑δi=1ciM(s)进行比较,从而确定多项式矩阵M(s)的列既约性。
三、程序流程图
四、使用说明
1.运行程序project1.exe;
2.按初始化键,输入多项式矩阵的行数和列数;
3.点击输入窗口可输入相应多项式。
输入多项式的格式如下所示:
s^6+7s^5+3s^2-4s-125
其中s的最高次数不能超过99,输入时次数由高到低排列;
4.进行列既约分析;输出结果将显示在屏幕上;
5.关闭程序。
五、举例例1:
例2:
附:
软件清单(编程环境windows2000+delphi6)
unitUnit1;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,Grids,ComCtrls,StdCtrls,Gauges;
typesss=array[0..100]ofinteger;
type
TForm1=class(TForm)
PageControl1:
TPageControl;
TabSheet1:
TTabSheet;
TabSheet2:
TTabSheet;
StringGrid1:
TStringGrid;
Button4:
TButton;
Edit1:
TEdit;
Label1:
TLabel;
StringGrid2:
TStringGrid;
Label2:
TLabel;
procedureFormCreate(Sender:
TObject);
procedureButton4Click(Sender:
TObject);
procedureStringGrid1MouseDown(Sender:
TObject;Button:
TMouseButton;Shift:
TShiftState;X,Y:
Integer);
procedureEdit1KeyPress(Sender:
TObject;varKey:
Char);
procedureEdit1Exit(Sender:
TObject);
procedureFormResize(Sender:
TObject);
procedurePageControl1Change(Sender:
TObject);
procedurePageControl1Changing(Sender:
TObject;
varAllowChange:
Boolean);
private
{Privatedeclarations}
row,col:
integer;
procedurejyjs;
functioncaldet:
sss;
public
{Publicdeclarations}
procedurechangewidth(col:
integer;sender:
tstringgrid);end;
var
Form1:
TForm1;
s:
array[0..100,0..100]ofsss;
implementation
usesUnit2;
{$R*.dfm}
procedureTform1.changewidth(col:
integer;sender:
tstringgrid);var
i,j,k:
integer;
begin
k:
=32;
i:
=form1.Font.Size;
forj:
=1tosender.rowcountdo
iflength(sender.Cells[col,j])*(i-2)>kthen
k:
=length(sender.Cells[col,j])*(i-2);
sender.ColWidths[col]:
=k;
end;
procedureTForm1.FormCreate(Sender:
TObject);
begin
row:
=1;
col:
=1;
self.PageControl1.ActivePageIndex:
=0;
end;
procedureTForm1.Button4Click(Sender:
TObject);
var
i,j,k:
integer;
begin
ifform2.ShowModal=mrokthen
try
self.StringGrid1.Enabled:
=true;
self.Edit1.Enabled:
=true;
edit1.text:
='0';
self.StringGrid1.ColCount:
=strtoint(form2.colnumber.text)+1;self.StringGrid1.rowCount:
=strtoint(form2.rownumber.text)+1;self.StringGrid1.FixedCols:
=1;
self.StringGrid1.Fixedrows:
=1;
fori:
=1toself.StringGrid1.rowCount-1do
self.StringGrid1.Cells[0,i]:
=inttostr(i);
fori:
=1toself.StringGrid1.colCount-1do
self.StringGrid1.ColWidths[i]:
=32;
fori:
=1toself.StringGrid1.colCount-1do
self.StringGrid1.Cells[i,0]:
=inttostr(i);
fori:
=1toself.StringGrid1.ColCount-1do
forj:
=1toself.StringGrid1.rowCount-1do
self.StringGrid1.Cells[i,j]:
='0';
fori:
=1to100do
forj:
=1to100do
fork:
=0to100do
s[i,j][k]:
=0;
self.Edit1.SetFocus;
except
showmessage('无效的行数或列数!
');
end;
end;
procedureTForm1.StringGrid1MouseDown(Sender:
TObject;
Button:
TMouseButton;Shift:
TShiftState;X,Y:
Integer);begin
row:
=self.StringGrid1.row;
col:
=self.StringGrid1.col;
label1.Caption:
='s('+
inttostr(row)+','+
inttostr(col)+')=';
edit1.Text:
=self.StringGrid1.Cells[col,row];
edit1.Left:
=label1.Left+label1.Width+5;
edit1.Width:
=StringGrid1.Left+StringGrid1.Width-edit1.Left;edit1.SetFocus;
end;
procedureTForm1.Edit1KeyPress(Sender:
TObject;varKey:
Char);begin
ifkey=#13then
Edit1Exit(nil);
end;
procedureTForm1.Edit1Exit(Sender:
TObject);
var
i,j,k,q:
integer;
temp,s1,s2,s3:
string;
flag:
boolean;
begin
edit1.Text:
=lowercase(edit1.text);
flag:
=false;
try
fori:
=100downto1do
begin
ifi<>1then
j:
=pos('s^'+inttostr(i),edit1.text)
else
j:
=pos('s',edit1.text);
if(j<>0)then
begin
s[col,row][0]:
=i;
flag:
=true;
break;
end;
end;
k:
=1;
q:
=0;
temp:
=edit1.text;
ifflagthen
begin
fori:
=s[col,row][0]downto1do
begin
ifi=1then
q:
=pos('s',temp)
else
q:
=pos('s^'+inttostr(i),temp);
ifq<>0then
begin
ifq=1then
s[col,row][k]:
=1
else
if(copy(temp,1,q-1)='+')or(copy(temp,1,q-1)='-')thens[col,row][k]:
=strtoint(copy(temp,1,q-1)+'1')else
s[col,row][k]:
=strtoint(copy(temp,1,q-1));
ifi=1then
temp:
=copy(temp,q+length('s'),1000)
else
temp:
=copy(temp,q+length('s^'+inttostr(i)),1000);k:
=k+1;
end
else
begin
s[col,row][k]:
=0;
k:
=k+1;
end;
end;
iftemp=''then
s[col,row][k]:
=0
else
s[col,row][k]:
=strtoint(temp);
end
else
begin
s[col,row][0]:
=0;
s[col,row][1]:
=strtoint(edit1.text);
end;
except
showmessage('表达式格式错误!
请按照如下各式输入:
'+#13+'9
s^3+2s^2-3s+1');
exit;
end;
temp:
='';
fori:
=s[col,row][0]downto0do
begin
s1:
=inttostr(s[col,row][abs(i-s[col,row][0])+1]);s2:
='s^';
s3:
=inttostr(i);
ifstrtoint(s3)=0then
begin
s2:
='';s3:
='';
end
elseifstrtoint(s3)=1then
begin
s2:
='s';s3:
='';
end;
if(strtoint(s1)=0)then
begin
if(s[col,row][0]<>0)then
s1:
=''
else
s1:
='0';
s2:
='';
s3:
='';
end
else
begin
if(strtoint(s1)>0)and(i<>s[col,row][0])thens1:
='+'+s1;
ifi<>0then
begin
ifs1='-1'thens1:
='-';
ifs1='+1'thens1:
='+';
ifs1='1'thens1:
='';
end;
end;
temp:
=temp+s1+s2+s3;
end;
iftemp=''thentemp:
='0';
iftemp=edit1.Textthen
begin
self.StringGrid1.Cells[col,row]:
=temp;
changewidth(col,stringgrid1);
end
else
begin
showmessage('表达式格式错误!
请按照如下各式输入:
'+#13+'s^3+2s^2-3s+1');
exit;
end;
end;
procedureTForm1.FormResize(Sender:
TObject);
begin
edit1.Text:
=self.StringGrid1.Cells[col,row];
edit1.Left:
=label1.Left+label1.Width+5;
edit1.Width:
=StringGrid1.Left+StringGrid1.Width-edit1.Left;
end;
procedureTForm1.PageControl1Change(Sender:
TObject);
var
i:
integer;
begin
ifself.PageControl1.ActivePageIndex=1then
begin
self.StringGrid2.ColCount:
=self.StringGrid1.ColCount;
self.StringGrid2.rowCount:
=self.StringGrid1.rowCount+1;
fori:
=1toself.StringGrid2.rowCount-2do
self.StringGrid2.Cells[0,i]:
=inttostr(i);
self.StringGrid2.cells[0,self.StringGrid2.rowCount-1]:
='列最高次数';
fori:
=1toself.StringGrid2.colCount-1do
self.StringGrid2.ColWidths[i]:
=32;
fori:
=1toself.StringGrid2.colCount-1do
self.StringGrid2.Cells[i,0]:
=inttostr(i);
self.StringGrid2.ColWidths[0]:
=70;
self.StringGrid2.ColWidths[self.StringGrid2.colCount-1]:
=70;
jyjs;
end;
end;
proceduretform1.jyjs;
var
mc,mr,max,colsum,rowsum,deg,aa:
integer;
det:
sss;
detstr,str1,str2,s1,s2,s3:
string;
begin
//复制原矩阵
label2.caption:
='';
formc:
=1toself.StringGrid1.ColCount-1do
formr:
=1toself.StringGrid1.rowCount-1do
begin
self.StringGrid2.Cells[mc,mr]:
=self.StringGrid1.Cells[mc,mr];changewidth(mc,self.StringGrid2);
end;
//计算kc
colsum:
=0;
formc:
=1toself.StringGrid2.colCount-1do
begin
max:
=0;
formr:
=1toself.StringGrid2.rowCount-2do
begin
ifs[mc,mr][0]>maxthen
max:
=s[mc,mr][0];
end;
self.StringGrid2.cells[mc,self.StringGrid2.rowCount-1]:
=inttostr(max);colsum:
=colsum+max;
end;
//计算detM(s)
det:
=caldet;
deg:
=det[0];
detstr:
='';
foraa:
=det[0]downto0do
begin
s1:
=inttostr(det[abs(aa-det[0])+1]);
s2:
='s^';
s3:
=inttostr(aa);
ifstrtoint(s3)=0then
begin
s2:
='';s3:
='';
end
elseifstrtoint(s3)=1then
begin
s2:
='s';s3:
='';
end;
if(strtoint(s1)=0)then
begin
if(det[0]<>0)then
s1:
=''
else
s1:
='0';
s2:
='';
s3:
='';
end
else
begin
if(strtoint(s1)>0)and(aa<>det[0])thens1:
='+'+s1;
ifaa<>0then
begin
ifs1='-1'thens1:
='-';
ifs1='+1'thens1:
='+';
ifs1='1'thens1:
='';
end;
end;
detstr:
=detstr+s1+s2+s3;
end;
//显示结果
str2:
='';
if(det[0]=0)and(det[1]=0)then
begin
str1:
='M(s)是奇异的';
str2:
='M(s)不是列既约';
end
else
begin
str1:
='M(s)是非奇异的';
ifdeg=colsumthen
str2:
=str2+'M(s)是列既约的'
else
str2:
=str2+'M(s)不是列既约的';
end;
label2.caption:
=str1+''+
'∑kc='+inttostr(colsum)+''+#13+'detM(s)='+detstr+''+
'degdetM(s)='+inttostr(deg)+#13+str2;
end;
functiontform1.caldet:
sss;
var
n,aa:
integer;
a:
array[1..100]ofinteger;
str:
string;
he,ji,ji_temp:
sss;
procedurekkk(y:
integer);
var
m,q,k,j:
integer;//k第几层m,j循环变量a1,a2,a3,a4,flag:
integer;
begin
k:
=y+1;
ifk=n+1then//求det
begin
//求乘积
fora1:
=0to100do
ji[a1]:
=0;
ji[1]:
=1;
fora1:
=1tondo//s[a1,a[a1]]*ji
begin
ji_temp:
=ji;
ji[0]:
=ji[0]+s[a1,a[a1]][0];
fora4:
=1to100do
ji[a4]:
=0;
fora2:
=1tos[a1,a[a1]][0]+1do
fora3:
=1toji_temp[0]+1do
begin
ji[a2+a3-1]:
=ji[a2+a3-1]+ji_temp[a3]*s[a1,a[a1]][a2];end;
end;
//求和
//统一次数
ifhe[0] begin fora1: =he[0]+1downto1do he[a1+ji[0]-he[0]]: =he[a1]; fora1: =ji[0]-he[0]downto1do he[a1]: =0; he[0]: =ji[0]; end; ifji[0] begin fora1: =ji[0]+1downto1do ji[a1+he[0]-ji[0]]: =ji[a1]; fora1: =he[0]-ji[0]downto1do ji[a1]: =0; ji[0]: =he[0]; end; //累加 flag: =0; fora1: =1tondo fora2: =a1tondo ifa[a1]>a[a2]then flag: =flag+1; if(flagmod2)=0then flag: =1 else flag: =-1; fora1: =1tohe[0]+1do he[a1]: =he[a1]+flag*ji[a1]; fora1: =1to100do if(he[1]=0)and(he[0]<>0)then begin fora2: =1tohe[0]+1do he[a2]: =he[a2+1]; he[0]: =he[0]-1; end; exit; end; forj: =1tondo//产生数据 begin a[k]: =j; q: =0;//检查有无重复数据form: =1tok-1do ifa[m]=jthenq: =q+1; ifq=0then kkk(k); end; end; begin foraa: =0to100do he[aa]: =0; n: =self.StringGrid1.ColCount-1; kkk(0); caldet: =he; end; procedureTForm1.PageControl1Changing(Sender: TObject;varAllowChange: Boolean); begin allowchange: =edit1.Enabled end; end.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 一种 多项式 矩阵 列既约 分析 方法 汇总