Wolfram mathematica mathematica中的参数分形维数编码

Wolfram mathematica mathematica中的参数分形维数编码,wolfram-mathematica,dimension,fractals,Wolfram Mathematica,Dimension,Fractals,我是数学初学者。我用mathematica编写了寻找参数分形维数的代码。但它不起作用。有人能解释一下我错在哪里吗。 我的代码是: delta[0] = 0.001 lambda[0] = 0 div = 0.0009 a = 2 b = 2 terms = 100 fx[0] = NSum[1/n^b, {n, 1, terms}] fy[0] = 0 For[i = 1, i < 11, i++, delta[i] = delta[i - 1] + div; j = 0 Wh

我是数学初学者。我用mathematica编写了寻找参数分形维数的代码。但它不起作用。有人能解释一下我错在哪里吗。 我的代码是:

delta[0] = 0.001
lambda[0] = 0
div = 0.0009
a = 2
b = 2
terms = 100
fx[0] = NSum[1/n^b, {n, 1, terms}]
fy[0] = 0
For[i = 1, i < 11, i++,
 delta[i] = delta[i - 1] + div;
 j = 0
    While[lambda[j] <= Pi,
     j = j + 1;
     lambda[j] = lambda[j - 1] + delta[i];
     fx[j] = NSum[Cos[n^a*lambda[j]]/n^b, {n, 1, terms}]; 
     fy[j] = NSum[Sin[n^a*lambda[j]]/n^b, {n, 1, terms}];
     deltaL[j] = Sqrt[[fx[j] - fx[j - 1]]^2 + [fy[j] - fy[j - 1]]^2];
     ]
    Ldelta[i] = Sum[deltaL[j], {j, 1, 10}];
 ]
data = Table[{Log[delta[i]], Log[Ldelta[i]]}, {i, 1, 10}]
line = Fit[data, {1, x}, x]
ListPlot[data]
delta[0]=0.001
λ[0]=0
div=0.0009
a=2
b=2
术语=100
fx[0]=NSum[1/n^b,{n,1,terms}]
fy[0]=0
对于[i=1,i<11,i++,
delta[i]=delta[i-1]+div;
j=0

当[lambda[j]在两个地方,你错误地使用了[…]^2而不是(…)^2。Mathematica热衷于正确使用()与[…]与{}。如果你用分号结束每一个语句,你将来可能会遇到更少的模糊问题。如果你不这样做,Mathematica会在奇数时间认为你有一个语句乘以两个项目,而不是有两个单独的语句。