我的问题是:
centerdimension=3;
dx[1]=y[1]+x[1]*z[1];
dy[1]=-x[1]+y[1]*z[1]-x[1]*w[1];
dz[1]=0;
dw[1]=-w[1]+alpha*x[1]^2;
korder=5;
total1=4;
要么出错,要么无输出结果。
我把代码也附上,请大家看看问题出在哪里。
- This program is to compute the centermaniford
- ReadList["e:\center1.txt"]
- remainder=total1-centerdimension
- "******************************"
- "To compute the zero space of the stable maniford and y[i]"
- "******************************"
- If [centerdimension==1,
- aa=Table[a[i,j],{i,remainder},{j,2,korder}];
- hx=Table[0,{remainder}];
- Do[
- hx[[i]]=Sum[a[i,j] x[1]^j,{j,2,korder}]+O[x[1]]^(korder+1),{i,1, remainder }];
- my=Table[0,{remainder}];
- Do[
- y[i]=hx[[i]],{i,1,remainder}];
- Do[
- nx=D[hx[[i]],x[1]] dx[1]-dy[i]==0;
- my[[i]]=LogicalExpand[nx]
- ,{i,1,remainder}];
- myok=Flatten[my];
- aij1=Flatten[aa];
- my2=Solve[myok,aij1];
- my2= Flatten [my2];
- dx[1]=Simplify[dx[1]/.my2];
- dx[1]=Normal[dx[1]];
- ]
- If[centerdimension==2,
- ahij2={};
- Do[
- Do[
- Do[
- i=l-j; ahij2=Join[{a[h,i,j]},ahij2]
- ,{j,0,l}]
- ,{l,2,korder}]
- ,{h,1,remainder}];
- Do[
- hyx=0;
- Sum[Do[i=l-j;hyx=hyx+a[h,i,j] x[1]^i x[2]^j,{j,0,l}],{l,2,korder}];
- y[h]=hyx
- ,{h,1,remainder}] ;
- nx=Table[0,{remainder}] ;
- coe={};
- Do[
- nx[[h]]=Sum[D[y[h],x[ii]] dx[ii],{ii,1,centerdimension}]-dy[h]
- ,{h,1,remainder}];
- Do[
- Do[
- Do[
- i=ip-j;
- mycoe=Coefficient[nx[[h]],x[1],i];
- mycoe=Coefficient[mycoe,x[2],j]/.{x[1]->0,x[2]->0} ;
- coe=Join[{mycoe==0},coe]
- ,{j,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- me=Solve[coe,ahij2];
- me=Flatten[me];
- Do[
- y[i]=y[i]/.me
- ,{i,1,remainder}];
- ]
- If[centerdimension==3,
- ahijp3={};
- Do[
- Do[
- Do[
- Do[
- p=ip-i-j;
- ahijp3=Join[{a[h,i,j,p]},ahijp3]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- Do[
- hyx=0;
- Do[
- Do[
- Do[
- p=ip-i-j;
- hyx=hyx+a[h,i,j,p] x[1]^i x[2]^j x[3]^p
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}];
- y[h]=hyx;
- ,{h,1,remainder}];
- nx=Table[0,{remainder}];
- coe={};
- Do[
- nx[[h]]=Sum[D[y[h],x[ii]] dx[ii],{ii,1,centerdimension}]-dy[h]
- ,{h,1,remainder}];
- Do[
- Do[
- Do[
- Do[
- p=ip-i-j ;
- mycoe=Coefficient[nx[[h]],x[1],i];
- mycoe=Coefficient[mycoe,x[2],j] ;
- mycoe=Coefficient[mycoe,x[3],p]/.{x[1]->0,x[2]->0,x[3]->0};
- coe=Join[{mycoe==0},coe]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- me=Solve[coe,ahijp3];
- me=Flatten[me];
- Do[y[i]=y[i]/.me,{i,1,remainder}];
- ]
- If[centerdimension==4,
- ahijpl4={};
- Do[
- Do[
- Do[
- Do[
- Do[
- l=ip-i-j-p;
- ahijp14=Join[{a[h,i,j,p,l]},ahijpl4]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- {i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- Do[
- hyx=0;
- Do[
- Do[
- Do[
- Do[
- l=ip-i-j-p;
- hyx=hyx+a[h,i,j,p,l] x[1]^i x[2]^j x[3]^p x[4]^l;
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}];
- y[h]=hyx;
- ,{h,1,remainder}];
- nx=Table[0,{remainder}] ;
- coe={} ;
- Do[
- nx[[h]]=Sum[D[y[h],x[ii]] dx[ii],{ii,1,centerdimension}]-dy[h]
- ,{h,1,remainder}] ;
- Do[
- Do[
- Do[
- Do[
- Do[
- l=ip-i-j-p;
- mycoe=Coefficient[nx[[h]],x[1],i];
- mycoe=Coefficient[mycoe,x[2],j] ;
- mycoe=Coefficient[mycoe,x[3],p] ;
- mycoe=Coefficient[mycoe,x[4],l]/.{x[1]->0,x[2]->0,x[3]->0,x[4]->0};
- coe=Join[{mycoe==0},coe]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}] ;
- me=Solve[coe,ahijpl4] ;
- me=Flatten[me];
- Do[
- y[i]=y[i]/.me
- ,{i,1,remainder}];
- ]
- If[centerdimension==5,
- ahijplm5={};
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- m=ip-i-j-p-l;
- ahijplm5=Join[{a[h,i,j,p,l,m]},ahijplm5]
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- Do[
- hyx=0;
- Do[
- Do[
- Do[
- Do[
- Do[
- m=ip-i-j-p-l;
- hyx=hyx+a[h,i,j,p,l,m] x[1]^i x[2]^j x[3]^p x[4]^l x[5]^m;
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}];
- y[h]=hyx;
- ,{h,1,remainder}];
- nx=Table[0,{remainder}] ;
- coe={} ;
- Do[
- nx[[h]]=Sum[D[y[h],x[ii]] dx[ii],{ii,1,centerdimension}]-dy[h]
- ,{h,1,remainder}] ;
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- m=ip-i-j-p-l;
- mycoe=Coefficient[nx[[h]],x[1],i];
- mycoe=Coefficient[mycoe,x[2],j] ;
- mycoe=Coefficient[mycoe,x[3],p] ;
- mycoe=Coefficient[mycoe,x[4],l] ;
- mycoe=Coefficient[mycoe,x[5],m]/.{x[1]->0,x[2]->0,x[3]->0,x[4]->0,x[5]->0} ;
- coe=Join[{mycoe==0},coe]
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}] ;
- Print[ "To solve the equation"];
- me=Solve[coe,ahijplm5] ;
- me=Flatten[me];
- Print[me]
- Do[
- y[i]=y[i]/.me,
- {i,1,remainder}];
- ]
- If[centerdimension==6,
- ahijplmn6={};
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- n=ip-i-j-p-l-m;
- ahijplmn6=Join[{a[h,i,j,p,l,m,n]},ahijplmn6];
- ,{m,0,ip-i-j-p-l}]
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}];
- Do[
- hyx=0;
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- n=ip-i-j-p-l-m;
- hyx=hyx+a[h,i,j,p,l,m,n] x[1]^i x[2]^j x[3]^p x[4]^l x[5]^m x[6]^n;
- ,{m,0,ip-i-j-p-l}]
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}];
- y[h]=hyx;
- ,{h,1,remainder}];
- nx=Table[0,{remainder}] ;
- coe={} ;
- Do[
- nx[[h]]=Sum[D[y[h],x[ii]] dx[ii],{ii,1,centerdimension}]-dy[h]
- ,{h,1,remainder}] ;
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- Do[
- n=ip-i-j-p-l-m;
- mycoe=Coefficient[nx[[h]],x[1],i];
- mycoe=Coefficient[mycoe,x[2],j] ;
- mycoe=Coefficient[mycoe,x[3],p] ;
- mycoe=Coefficient[mycoe,x[4],l] ;
- mycoe=Coefficient[mycoe,x[5],m] ;
- mycoe=Coefficient[mycoe,x[6],n]/.{x[1]->0,x[2]->0,x[3]->0,x[4]->0,x[5]->0,x[6]->0} ;
- coe=Join[{mycoe==0},coe]
- ,{m,0,ip-i-j-p-l}]
- ,{l,0,ip-i-j-p}]
- ,{p,0,ip-i-j}]
- ,{j,0,ip-i}]
- ,{i,0,ip}]
- ,{ip,2,korder}]
- ,{h,1,remainder}] ;
- Print[ "To solve the equation "];
- me=Solve[coe,ahijplmn6] ;
- me=Flatten[me];
- Print[me]
- Do[
- y[i]=y[i]/.me,{i,1,remainder}];
- ]
- "******************************"
- "To compute the centermaniford and crop the higher order items"
- "******************************"
- centermaniford={}
- Do[
- dx[jj]=dx[jj];
- dx[jj]=Expand[dx[jj]];
- len=Length[dx[jj]];
- eff=Table[0,{len}];
- Do[
- item=dx[jj][[i]];
- ee=0;
- Do[
- eii=Exponent[item,x[ii]];
- ee=ee+eii;
- ,{ii,1,centerdimension}];
- If[ee>korder,eff[[i]]=eff[[i]],eff[[i]]=eff[[i]]+item];
- ,{i,1,len}];
- dx[jj]=0;
- len1=Length[eff];
- Do[
- dx[jj]=dx[jj]+eff[[i]];
- ,{i,1,len1}];
- centermaniford=Join[{dx[jj]},centermaniford];
- ,{jj,1,centerdimension}]
- centermaniford=Reverse[centermaniford]>>e:\center.out
- centermaniford=Simplify[centermaniford]
- Print["This is the end of the program"]
复制代码 |