Chi*_*tle 2 wolfram-mathematica
Graphics@Flatten[Table[
(*colors, dont mind*)
{ColorData["CMYKColors"][(a[[r, t]] - .000007)/(.0003 - 0.000007)],
(*point size, dont mind*)
PointSize[1/Sqrt[r]/10],
(*Coordinates for your points "a" is your data matrix *)
Point[
{(rr =Log[.025 + (.58 - .25)/64 r]) Cos@(tt = t 5 Degree),
rr Sin@tt}]
} &@
(*values for the iteration*)
, {r, 7, 64}, {t, 1, 72}], 1]
(*Rotation, dont mind*)
/. gg : Graphics[___] :> Rotate[gg, Pi/2]
Run Code Online (Sandbox Code Playgroud)
好的,我会咬人的.首先,Mathematica允许通过以下几种形式之一应用函数:标准形式 - f[x]
,前缀形式 - f @ x
,后缀形式 - f // x
和中缀形式 - x ~ f ~ y
.Belisarius的代码使用标准和前缀形式.
那么,让我们先看看最外面的函数: Graphics @ x /. gg : Graphics[___]:> Rotate[gg,Pi/2]
,x
里面的一切都在哪里Flatten
.基本上,这样做是Graphics
从一个对象创建一个对象x
并使用一个命名模式(gg : Graphics[___]
)将结果Graphics
对象旋转90度.
现在,要创建一个Graphics
对象,我们需要提供一堆基元,这是一个嵌套列表的形式,其中每个子列表描述一些元素.这是通过Table
具有以下形式的命令完成的:Table[ expr, iterators ]
.迭代器可以有几种形式,但在这里,他们都有的形式{var, min, max}
,并且因为他们缺乏一个第四学期,他们承担之间的每个值min
,并max
在整数的步骤.因此,我们的迭代器是{r, 7, 64}
和{t, 1, 72}
,并且expr
针对它们所采用的每个值进行评估.因为,我们有两个迭代器,它会产生一个混淆的矩阵,Graphics
所以我们使用Flatten[ Table[ ... ], 1]
矩阵的每个元素并将它放入一个简单的列表中.
Table
生成的每个元素都是:color(ColorData
),point size(PointSize
)和point location(Point
).因此,Flatten
我们创建了以下内容:
Graphics[{{color, point size, point}, {color, point size, point}, ... }]
Run Code Online (Sandbox Code Playgroud)
颜色生成取自数据,并假定数据已放入名为的列表中a
.a
通过Part
构造访问各个元素:[[]]
.在表面上,ColorData
构造有点奇怪,但是当提供0到1之间的值时,它可以被读作ColorData["CMYKColors"]
返回a ColorDataFunction
产生CMYK颜色值.这就是为什么数据a
按照它的方式缩放的原因.
点大小由径向坐标生成.您可以预期1/Sqrt[r]
点大小应该随着r
增加而变小,但是Log
反转比例.
类似地,点位置是从radial和angular(t
)变量生成的,但Point
只接受它们的{x,y}
形式,所以他需要转换它们.两个奇数结构出现在转换{r,t}
中{x,y}
:两个rr
并且tt
是Set(=
),同时计算x
允许它们在计算时使用y
.此外,该术语t 5 Degree
让Mathematica知道角度是以度为单位,而不是弧度.此外,正如所写,有一个错误:在结束后立即}
,条款&
,@
不应该在那里.
这有帮助吗?