关于分形的几个算法
前些日子,对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-y)*(x-y)+(x-y)*(x-y));
return dis;
}
void henonfun(long double *x,long double pa,long double pb)
{
long double y={0.0,0.0};
y=x;
y=x;
x=1-pa*y*y+pb*y;
x=y;
return;
}
long double possibility(long double *x,long double (*y))
{
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={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;
for(i=0;i<N0;i++)
{
save=0;
save=0;
}
for(i=0;i<N0;i++)
{
henonfun(xini,pa,pb);
save=xini;
save=xini;
}
cout<<"save the data has ended!"<<endl;
int suiji;
for(int j=0;j<int(0.2*N0);j++)
{
suiji=rand()%N0;
}
long double average=0.0;
for(j=0;j<int(0.2*N0);j++)
{
xini=save];
xini=save];
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 编辑 ] 原帖由 yanzy128 于 2007-6-14 08:47 发表 http://www.chinavib.com/forum/images/common/back.gif
前些日子,对Henon映射混沌吸引子的维数进行了计算。
发现,计算出来的维数接近1.26;可是从Poincare截面上
观察到的吸引子,明显不同。
计算分形维数时,我是采用点形维。
有人用别的维数,对Henon映射进行 ...
分形维数与Poincare截面上的吸引子明显不同? 那你贴上来看看!
页:
[1]