跳转到内容

分形/复平面迭代/离散拉格朗日描述符

来自维基教科书,开放世界的开放书籍

连续时间动力系统(拉格朗日描述流的方法)[1] [2] [3] [4] 是分析相空间结构的一种方法。这里[5] [6] [7] [8] 该方法扩展到离散动力系统:复平面上的开放映射。



完整源代码在公共页面上(点击图像)

关键词

[编辑 | 编辑源代码]

复映射

[编辑 | 编辑源代码]

映射


黎曼球面

[编辑 | 编辑源代码]

黎曼球面上的点


立体投影逆变换

[编辑 | 编辑源代码]
从北极到球体下方平面的立体投影的 3D 图示

立体投影逆变换将复平面的点 映射到黎曼球面上的点


所以



 
 



向量 -范数(也称为 -范数)是[9]


其中

  • 数字 p 是实数 。它被称为幂。它会影响奇点(如朱利亚集等分形特征)附近的梯度的陡峭程度

p-范数用于度量映射 f 在黎曼球面上连续迭代之间的距离

离散拉格朗日描述符 = DLD

[编辑 | 编辑源代码]
  The simple idea is to compute the p-norm version of Lagrangian descriptors, not for the points on the complex plane, but for their projections on the Riemann sphere in the extended complex plane.
  ... in the complex mappings that we consider in this work, the functions that define the dynamics are not invertible, and therefore we will only keep the forward part of the definition.  

DLD

  • 是一个标量值
  • 累积轨道的 p-范数(= 包含有关轨道历史的信息),因此揭示了朱利亚集内部和外部的结构
 summing is what the original paper does ( pauldelbrot)

其中

  • N 是固定迭代次数
  • 是复平面上有界子集 D 上选取的任何初始条件
  • 是黎曼球面上的一个点:
 "averaging keeps the coloring stable if maxiters is changed but can lead to low variation over the image" pauldelbrot

对于复平面上的每个点 z

  • 计算 DLD(标量值)
  • 颜色与 DLD 成比例

子步骤:计算 z 的 DLD

  • 在映射 f 下迭代点 z = 计算 zn
  • 将每个点 zn 从复平面映射到黎曼球面(反立体投影)
  • 对于每个 zn 计算被加数
  • ... (待办事项)

UltraFractal

[编辑 | 编辑源代码]
DLD {
; Based on https://arxiv.org/pdf/2001.08937.pdf
; ucl file for UltraFractal by pauldelbrot
init:
  float sum = 0.0
  float lastx = 0.0
  float lasty = 0.0
  float lastz = 0.0
  int i = 0
loop:
  float d = |#z|
  float dd = 1/(d + 1)
  ; Riemann sphere coordinates = (xx, yy,zz)
  float xx = 2*real(#z)*dd
  float yy = 2*imag(#z)*dd
  float zz = (d - 1)*dd     
  :
  IF (i > 0)
    sum = sum + (xx - lastx)^@power + (yy - lasty)^@power + (zz - lastz)^@power
  ENDIF
  i = i + 1
  lastx = xx
  lasty = yy
  lastz = zz
final:
  #index = sum/(i - 1)
default:
  title = "Discrete Langrangian Descriptors"
  param power
    caption = "Power"
    default = 0.25
    hint = "Affects the steepness of the gradient near singularities (fractal features like a Julia set)"
    min = 0.0
  endparam
}
  " Here's the latest version I've been using in UF. It handles escaping points with no-bail formulae via the isInf/isNaN test (puts the Riemann sphere point at the north pole for those), allows averaging or summing (summing is what the original paper does, whereas averaging keeps the coloring stable if maxiters is changed but can lead to low variation over the image), and can use or not use absolute values on the differences being summed." pauldelbrot
DLD {
; Based on https://arxiv.org/pdf/2001.08937.pdf
; ucl file for UltraFractal by pauldelbrot
init:
  float sum = 0.0
  float lastx = 0.0
  float lasty = 0.0
  float lastz = 0.0
  int i = 0
loop:
  float d = |#z|
  float dd = 1/(d + 1)
  float xx = 2*real(#z)*dd
  float yy = 2*imag(#z)*dd
  float zz = (d - 1)*dd     ; Riemann sphere coordinates
  IF (isInf(d) || isNaN(d))
    ; Infinity, or thereabouts
    xx = 0
    yy = 0
    zz = 1
  ENDIF
  IF (i > 0)
    IF(@qabs)
      sum = sum + abs(xx - lastx)^@power + abs(yy - lasty)^@power + abs(zz - lastz)^@power
    ELSE
      sum = sum + (xx - lastx)^@power + (yy - lasty)^@power + (zz - lastz)^@power
    ENDIF
  ENDIF
  i = i + 1
  lastx = xx
  lasty = yy
  lastz = zz
final:
  IF(@qsum)
    #index = sum
  ELSE
    #index = sum/(i - 1)
  ENDIF
default:
  title = "Discrete Langrangian Descriptors"
  param power
    caption = "Power"
    default = 0.25
    hint = "Affects the steepness of the gradient near singularities (fractal features like a Julia set)"
    min = 0.0
  endparam
  param qsum
    caption = "Sum"
    default = false
    hint = "Averages if false, sums if true."
  endparam
  param qabs
    caption = "Abs differences"
    default = false
  endparam
}

Fragmentarium

[编辑 | 编辑源代码]

基于 UF 代码的代码,由 3Dickulus 为 GLSL 修改和优化[10]

#include "Complex.frag"
#include "MathUtils.frag"
#include "Progressive2D.frag"
#info Unveiling Fractal Structure with Lagrangian Descriptors
#info https://fractalforums.org/fractal-mathematics-and-new-theories/28/unveiling-the-fractal-structure-of-julia-sets-with-lagrangian-descriptors/3376/msg20446#msg20446

#group Lagrangian

// Number of iterations
uniform int  Iterations; slider[1,200,1000]
uniform vec3 RGB; slider[(0,0,0),(0.0,0.4,0.7),(1,1,1)]
uniform bool Julia; checkbox[false]
uniform vec2 JuliaXY; slider[(-2,-2),(-0.6,1.3),(2,2)]
uniform float p; slider[0,.6,1]

/* partial pnorm
   input: z, c, p
   output ppn
*/

float ppnorm( vec2 z, vec2 c, float p){

	vec3 s0,s1; // for 2 points on the Riemann sphere
	float d; // denominator
	float ds;

	// map from complex plane to riemann sphere
	// z
	d = z.x*z.x + z.y*z.y + 1.0;
	s0 = vec3(2.0*z,(d-2.0))/d;
	// zn
	d = c.x*c.x + c.y*c.y + 1.0;
	s1 = vec3(2.0*c,(d-2.0))/d;
	// sum
	vec3 ss = pow(abs(s1 - s0),vec3(p));
   ds = ss.x+ss.y+ss.z;

	return ds;
}

// DLD = Discret Lagrangian Descriptior
float lagrangian( vec2 z, vec2 c, float p ){

	int i; // number of iteration
	float d = 0.0; // DLD = sum

	for (i=0; i<Iterations; ++i){
		d += ppnorm(z, c, p); // sum z
		z = cMul(z,z) +c; // complex iteration
		if (cAbs(z) > 1e19 ) break; // exterior : upper limit of float type
	}

	d /= float(i); // averaging not summation

	return d;
}

vec3 color(vec2 c) {
	vec2 z = Julia ? c : vec2(0.,0.);
	if(Julia) c = JuliaXY;
	float co = lagrangian( z, c, p );
	return .5+.5*cos(6.2831*co+RGB);
}

#preset Default
Center = -0.724636541,0.025224931
Zoom = 0.64613535
EnableTransform = false
RotateAngle = 0
StretchAngle = 0
StretchAmount = 0
Gamma = 2.2
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
AARange = 2
AAExp = 1
GaussianAA = true
Iterations = 20
RGB = 0,0.4,0.7
p = 0.1444322
Julia = false
JuliaXY = -1.05204872,0
Bailout = 1000
#endpreset

#preset Basilica
Center = -0.025346913,-0.013859176
Zoom = 0.561856826
EnableTransform = false
RotateAngle = 0
StretchAngle = 0
StretchAmount = 0
Gamma = 2.2
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
AARange = 2
AAExp = 1
GaussianAA = true
Iterations = 20
RGB = 0,0.4,0.7
p = 0.1444322
Julia = true
JuliaXY = -1.05204872,0
Bailout = 1000
#endpreset
/* partial pnorm 
   input: z , zn = f(z), p
   output ppn

*/
double ppnorm( complex double z, complex double zn, double p){

	double s[2][3]; // array for 2 points on the Riemann sphere
	int j; 
	double d; // denominator 
	double x; 
	double y;
	
	double ds;
	double ppn = 0.0;
	
	// map from complex plane to riemann sphere
	// z
	x = creal(z);
	y = cimag(z);
	d = x*x + y*y + 1.0;
	
	s[0][0] = (2.0*x)/d;
	s[0][1] = (2.0*y)/d;  
	s[0][2] = (d-2.0)/d; // (x^2 + y^2 - 1)/d
	
	// zn
	x = creal(zn);
	y = cimag(zn);
	d = x*x + y*y + 1.0;
	s[1][0] = (2.0*x)/d;
	s[1][1] = (2.0*y)/d;  
	s[1][2] = (d-2.0)/d; // (x^2 + y^2 - 1)/d
	
	// sum 
	for (j=0; j <3; ++j){
		ds = fabs(s[1][j] - s[0][j]);
		ppn += pow(ds,p); // |ds|^p
		}
	return ppn;
}

// DLD = Discret Lagrangian Descriptior
double lagrangian( complex double z0, complex double c, int iMax, double p ){

	int i; // number of iteration
	double d = 0.0; // DLD = sum
	double ppn; // partial pnorm
	complex double z = z0;
	complex double zn; // next z
	
	
	if (cabs(z) < AR || cabs(z +1)< AR) return 5.0; // for z= 0.0 d = inf
	
	
	for (i=0; i<iMax; ++i){
	
        zn = z*z +c; // complex iteration
		ppn = ppnorm(z, zn, p);
		d += ppn; // sum
		//
		z = zn; 
		
		if (cabs(z) > ER ) break; // exterior : big values produces NAN error in ppnorm computing 
		if (cabs(z) < AR || cabs(z +1)< AR) 
			{ // interior
				d = -d;
				break; 
				
			}
		}
	 
	d =  d/((double)i); // averaging not summation
	if (d<0.0) {// interior
		d = 2.5 - d;
	}
	return d; 
}

unsigned char ComputeColorOfDLD(complex double z){

 	
  	int iColor;
  	double d;

  	d = lagrangian(z,c, N,p);
  	iColor = (int)(d*255)  % 255; // color is proportional to d
  
  
  return (unsigned char) iColor;
}

参考文献

[编辑 | 编辑源代码]
  1. C. Mendoza,A. M. Mancho。海洋流动的隐藏几何结构。物理评论快报 105 (2010),3,038501-1-038501-4。
  2. A. M. Mancho,S. Wiggins,J. Curbelo,C. Mendoza。拉格朗日描述符:揭示一般时间相关动力系统相空间结构的方法。非线性科学与数值模拟通讯。18 (2013) 3530-3557
  3. C. Lopesino,F. Balibrea-Iniesta,V. J. García-Garrido,S. Wiggins,A. M. Mancho。拉格朗日描述符的理论框架。分岔与混沌国际期刊 27, 1730001 (2017)。
  4. 维基百科中的流动场拉格朗日描述
  5. C. Lopesino,F. Balibrea,S. Wiggins,A.M. Mancho。二维、面积守恒自映射和非自映射的拉格朗日描述符。非线性科学与数值模拟通讯 27 (1-3) (2015) 40-51。
  6. V. J . Garcia Garrido。用拉格朗日描述符揭示朱利亚集的分形结构。 https://arxiv.org/abs/2001.08937
  7. V. J. García-Garrido,F. Balibrea-Iniesta,S. Wiggins,A. M. Mancho,C. Lopesino。用拉格朗日描述符检测猫映射的相空间结构。规则与混沌动力学 23, (6) 751-766 (2018)。
  8. G. G. Carlo 和 F. Borondo。开放映射的拉格朗日描述符 Phys. Rev. E 101, 022208 (2020)
  9. 维基百科中的 Lp 空间,当 0<p <1 时
  10. fractalforums.org: lagrangian-descriptors-fragment-code

V. J. García-Garrido。用拉格朗日描述符揭示朱利亚集的分形结构。《非线性科学与数值模拟通讯》第 91 卷 (2020) 105417。

华夏公益教科书