当前位置: 首页 > news >正文

在Mathematica中使用BinCounts绘制de Jong吸引子

使用BinCounts,可以做如下编码:

naiveDeJong[{x_, y_}, {a_, b_, c_, d_}] := {Sin[a y] - Cos[b x], Sin[c x] - Cos[d y]}Log[(BinCounts[NestList[naiveDeJong[#, {1.641, 1.902, 0.316, 1.525}] &, {1., 1.},10^5], {-2, 2, 0.005}, {-2, 2, 0.005}] + 1)] // ArrayPlot

这个迭代非常慢,并且在运行中很容易代买存储问题。相反的,可以编译迭代器并同时归结到某统计堆。

dejongCompiled = Compile[{{xmin, _Real}, {xmax, _Real}, {ymin, _Real}, {ymax, \
_Real}, {delta, _Real}, {itmax, _Integer}, {a, _Real, 0}, {b, _Real, 0}, {c, _Real, 0}, {d, _Real, 0}}, Block[{bins, dimx, dimy, x, y, tx, ty}, bins = ConstantArray[0, Floor[{xmax - xmin, ymax - ymin}/delta] + {1, 1}];{dimx, dimy} = Dimensions[bins];{x, y} = {0., 0.};Do[{x, y} = {Sin[a y] - Cos[b x], Sin[c x] - Cos[d y]};tx = Floor[(x - xmin)/delta] + 1;ty = Floor[(y - ymin)/delta] + 1;If[tx >= 1 && tx <= dimx && ty >= 1 && ty <= dimy, bins[[tx, ty]] += 1], {i, 1, itmax}];bins], RuntimeOptions -> "Speed"(*,CompilationTarget\[RuleDelayed]"C"*)];ArrayPlot[Log[dejongCompiled[-2., 2., -2., 2., 0.005, 10000000, 1.641, 1.902, 0.316, 1.525] + 1], Frame -> False, ImageSize -> 500, ColorFunction -> (ColorData["CMYKColors"][1 - #] &)]

相关文章:

  • 紫外波段太阳光模拟器介绍
  • 006-nlohmann/json 结构转换-C++开源库108杰
  • 【RabbitMq C++】消息队列组件
  • mapreduce
  • 鸿蒙OSUniApp 开发的下拉刷新与上拉加载列表#三方框架 #Uniapp
  • Elasticsearch索引设计与调优
  • FPGA在光谱相机中的核心作用
  • Single image dehazing论文阅读
  • 3Dblox
  • 反射, 注解, 动态代理
  • 【springcloud学习(dalston.sr1)】Eureka单个服务端的搭建(含源代码)(三)
  • C++类和对象:运行符重载、取地址运算符重载、const 修饰的类如何作为参数
  • leetcode刷题---二分查找
  • BGP联邦+反射器实验
  • HTML应用指南:利用POST请求获取全国圆通快递服务网点位置信息
  • 【时时三省】(C语言基础)使用字符串处理函数2
  • 车用CAN接口芯片:汽车神经系统的沉默构建者
  • 【Python 算法零基础 2.模拟 ④ 基于矩阵】
  • 鸿蒙OSUniApp 实现图片上传与压缩功能#三方框架 #Uniapp
  • c++和c的不同
  • 经济日报评外卖平台被约谈:行业竞争不能背离服务本质
  • 香港特区立法会通过条例草案便利外地公司迁册来港
  • 山东:小伙为救同学耽误考试属实,启用副题安排考试
  • 深圳中院回应“退休夫妻月入1.2万负债1.2亿”:其自述因经营不善负债
  • 熊出没!我驻日本札幌总领馆提示中国公民注意人身安全
  • 王毅集体会见加勒比建交国外长及代表