声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2213|回复: 1

[分形与混沌] 关于分形的几个算法

[复制链接]
发表于 2007-6-14 08:47 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

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 编辑 ]

本帖被以下淘专辑推荐:

回复
分享到:

使用道具 举报

发表于 2007-6-14 09:18 | 显示全部楼层
原帖由 yanzy128 于 2007-6-14 08:47 发表
前些日子,对Henon映射混沌吸引子的维数进行了计算。
发现,计算出来的维数接近1.26;可是从Poincare截面上
观察到的吸引子,明显不同。
计算分形维数时,我是采用点形维。
有人用别的维数,对Henon映射进行 ...



分形维数与Poincare截面上的吸引子明显不同? 那你贴上来看看!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-20 13:50 , Processed in 0.097795 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表