|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
前些日子,对Henon映射混沌吸引子的维数进行了计算。
发现,计算出来的维数接近1.26;可是从Poincare截面上
观察到的吸引子,明显不同。
计算分形维数时,我是采用点形维。
有人用别的维数,对Henon映射进行计算的请回应,大家讨论下!
见程序:
#include <iostream.h>
#include <math.h>
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
const long double eps=0.00000000000001;
const int N0=5000;
inline int heaviside(double r)
{
return (r>eps)?0:1;
}
long double distance( long double *x,long double *y)
{
long double dis=-1;
dis=sqrt((x[0]-y[0])*(x[0]-y[0])+(x[1]-y[1])*(x[1]-y[1]));
return dis;
}
void henonfun(long double *x,long double pa,long double pb)
{
long double y[2]={0.0,0.0};
y[0]=x[0];
y[1]=x[1];
x[0]=1-pa*y[0]*y[0]+pb*y[1];
x[1]=y[0];
return;
}
long double possibility(long double *x,long double (*y)[2])
{
long double dis=-1;
long double sum=0.0;
for(int i=0;i<N0;i++)
{
sum+=heaviside(distance(x,*(y+i)));
}
return sum/N0;
}
int main()
{
cout<<"please choose your choice firstly!"<<endl;
while(1)
{
char ch=getchar();
if(ch=='c')
{ cout<<"Now begin to caculate the 点形维"<<endl;
cout<<"please input the peremeter of henon mapping:"<<endl;
long double pa(-1000);
long double pb(-1000);
cin>>pa;
cout<<"the pa of henon mapping is"<<pa<<endl;
cin>>pb;
cout<<"the pb of henon mapping is"<<pb<<endl;
long double xini[2]={0.5,0.5};
for(int i=0;i<500;i++)
{
henonfun(xini,pa,pb);
}
cout<<"the trasient progress ended!"<<endl;
cout<<"wait for a moment..."<<endl;
long double save[N0][2];
for(i=0;i<N0;i++)
{
save[0]=0;
save[1]=0;
}
for(i=0;i<N0;i++)
{
henonfun(xini,pa,pb);
save[0]=xini[0];
save[1]=xini[1];
}
cout<<"save the data has ended!"<<endl;
int suiji[int(0.2*N0)];
for(int j=0;j<int(0.2*N0);j++)
{
suiji[j]=rand()%N0;
}
long double average=0.0;
for(j=0;j<int(0.2*N0);j++)
{
xini[0]=save[suiji[j]][0];
xini[1]=save[suiji[j]][1];
average+=possibility(xini,save);
}
average=average/(0.2*N0);
cout<<"the dimension of henon mapping is"<<log(average)/log(eps)+1<<endl;
}
else if(ch=='h')
{
cout<<"show the help message!??"<<endl;
}
else if(ch=='p')
{
break;
}
else
{
cout<<"your choose is unleagla"<<endl;
}
}
return 1;
}
[ 本帖最后由 咕噜噜 于 2007-6-14 18:51 编辑 ] |
|