# 迭代函数系统

Sierpinski triangle created using IFS (colored to illustrate self-similar structure) 使用IFS创建的Sierpinski三角形（用颜色来说明自相似结构）。
Colored IFS designed using Apophysis software and rendered by the Electric Sheep. 彩色 IFS 使用Apophysis设计，使用Electric Sheep 电子羊渲染。

In mathematics, iterated function systems (IFSs) are a method of constructing fractals; the resulting fractals are often self-similar. IFS fractals are more related to set theory than fractal geometry.[1] They were introduced in 1981. 在数学中，迭代函数系统 iterated function systems(IFS)是一种构造分形几何 Fractal的方法；产生的分形通常是自相似的。IFS分形与集合论的关系比分形几何更大。它们于1981年被提出。 IFS fractals, as they are normally called, can be of any number of dimensions, but are commonly computed and drawn in 2D. The fractal is made up of the union of several copies of itself, each copy being transformed by a function (hence "function system"). The canonical example is the Sierpiński triangle. The functions are normally contractive, which means they bring points closer together and make shapes smaller. Hence, the shape of an IFS fractal is made up of several possibly-overlapping smaller copies of itself, each of which is also made up of copies of itself, ad infinitum. This is the source of its self-similar fractal nature. IFS 分形，正如他们被通常称呼一样，可以是任何维度的，但通常在2维空间计算和绘制。分形是由其本身的几个副本的结合体组成，每个副本都由一个函数变换而成（因此称为 "函数系统"）。典型的例子是谢尔宾斯基三角形Sierpiński triangle。这些函数通常是收缩的，这意味着它们使点更接近，使形状更小。因此，IFS分形的形状是由若干个可能重叠的较小副本组成的，每个副本也是由自己的副本组成的，无穷无尽ad infinitum。这就是其自相似分形性质的来源。

## Definition 定义

Formally, an iterated function system is a finite set of contraction mappings on a complete metric space.[2] Symbolically,

$\displaystyle{ \{f_i:X\to X\mid i=1,2,\dots,N\},\ N\in\mathbb{N} }$

is an iterated function system if each $\displaystyle{ f_i }$ is a contraction on the complete metric space $\displaystyle{ X }$. 从形式上看，迭代函数系统是一个完整的度量空间上的有限收缩映射集。符号表示为，

$\displaystyle{ \{f_i:X\to X\mid i=1,2,\dots,N\},\ N\in\mathbb{N} }$

## Properties 性质

Construction of an IFS by the chaos game (animated) 通过chaos game (动画) 构建的一个IFS
IFS being made with two functions. IFS由两个函数构建。

Hutchinson (1981) showed that, for the metric space $\displaystyle{ \mathbb{R}^n }$, or more generally, for a complete metric space $\displaystyle{ X }$, such a system of functions has a unique nonempty compact (closed and bounded) fixed set S. One way of constructing a fixed set is to start with an initial nonempty closed and bounded set S0 and iterate the actions of the fi, taking Sn+1 to be the union of the images of Sn under the fi; then taking S to be the closure of the union of the Sn. Symbolically, the unique fixed (nonempty compact) set $\displaystyle{ S\subseteq X }$ has the property

$\displaystyle{ S = \overline{\bigcup_{i=1}^N f_i(S)}. }$

$\displaystyle{ S = \overline{\bigcup_{i=1}^N f_i(S)}. }$

The set S is thus the fixed set of the Hutchinson operator $\displaystyle{ F: 2^X\to 2^X }$ defined for $\displaystyle{ A\subseteq X }$ via

$\displaystyle{ F(A)=\overline{\bigcup_{i=1}^N f_i(A)}. }$

$\displaystyle{ F(A)=\overline{\bigcup_{i=1}^N f_i(A)}. }$

The existence and uniqueness of S is a consequence of the contraction mapping principle, as is the fact that

$\displaystyle{ \lim_{n\to\infty}F^{\circ n}(A)=S }$

S的存在性和唯一性是contraction mapping principle的结果，就如

$\displaystyle{ \lim_{n\to\infty}F^{\circ n}(A)=S }$

for any nonempty compact set $\displaystyle{ A }$ in $\displaystyle{ X }$. (For contractive IFS this convergence takes place even for any nonempty closed bounded set $\displaystyle{ A }$). Random elements arbitrarily close to S may be obtained by the "chaos game," described below. 对于$\displaystyle{ X }$中的任何非空紧集$\displaystyle{ A }$。(对于收缩型IFS，即使对于任何非空的闭合有界集$\displaystyle{ A }$，也会发生这种收敛。)。任意接近S的随机元素可以通过下面描述的 "chaos game "获得。 Recently it was shown that the IFSs of noncontractive type (i.e. composed of maps that are not contractions with respect to any topologically equivalent metric in X) can yield attractors. 最近，人们证明了非收缩型的IFS(即由相对于X中的任何拓扑等价度量不收缩的映射组成)可以产生吸引子。 These arise naturally in projective spaces, though classical irrational rotation on the circle can be adapted too.[3] 这些都是在投影空间中自然产生的，尽管经典的圆上的无理旋转也可以适应。 The collection of functions $\displaystyle{ f_i }$ generates a monoid under composition. If there are only two such functions, the monoid can be visualized as a binary tree, where, at each node of the tree, one may compose with the one or the other function (i.e. take the left or the right branch). In general, if there are k functions, then one may visualize the monoid as a full k-ary tree, also known as a Cayley tree. 函数的集合$\displaystyle{ f_i }$能产生是运算下的独异点。如果只有两个这样的函数，那么这个单体可以可视化为一棵binary tree，在树的每一个节点上，我们可以用一个或另一个函数进行合成（取左支或右支）。一般来说，如果有k个函数，那么可以将单子可视化为一个完整的k-ary树，也称为Cayley tree

## Constructions 构建

Barnsley's fern, an early IFS Barnsley's fern，一个早期的 IFS
Menger sponge, a 3-Dimensional IFS. Menger sponge，一个3维的 IFS.

IFS "tree" constructed with non-linear function Julia

Sometimes each function $\displaystyle{ f_i }$ is required to be a linear, or more generally an affine, transformation, and hence represented by a matrix. However, IFSs may also be built from non-linear functions, including projective transformations and Möbius transformations. The Fractal flame is an example of an IFS with nonlinear functions. 有时，每个函数$\displaystyle{ f_i }$都必须是线性的linear，或者更一般的affine，变换，因此用matrix表示。然而，IFS也可以由非线性函数建立，包括projective transformationMöbius transformationFractal flame是一个非线性函数的IFS的例子。 The most common algorithm to compute IFS fractals is called the "chaos game". It consists of picking a random point in the plane, then iteratively applying one of the functions chosen at random from the function system to transform the point to get a next point. An alternative algorithm is to generate each possible sequence of functions up to a given maximum length, and then to plot the results of applying each of these sequences of functions to an initial point or shape. 计算IFS分形最常用的算法叫做"chaos game"。它包括在平面上随机选取一个点，然后反复应用从函数系统中随机选取的一个函数来变换该点，去得到下一个点。另一种算法是生成每一个可能的函数序列，直到给定的最大长度，然后将这些函数序列中的每一个应用于初始点或形状的结果绘制出来。 Each of these algorithms provides a global construction which generates points distributed across the whole fractal. If a small area of the fractal is being drawn, many of these points will fall outside of the screen boundaries. This makes zooming into an IFS construction drawn in this manner impractical. 这些算法中的每一种都提供了一个全局结构，生成分布在整个分形上的点。如果正在绘制分形的一小块区域，这些点中的许多将落在屏幕边界之外。这使得放大以这种方式绘制的IFS结构不切实际。 Although the theory of IFS requires each function to be contractive, in practice software that implements IFS only require that the whole system be contractive on average.[4] 虽然IFS的理论要求每个功能都是收缩的，但实际上实现IFS的软件只要求整个系统平均是收缩的。

## Partitioned iterated function systems 分割迭代函数系统

PIFS (partitioned iterated function systems), also called local iterated function systems,[5] give surprisingly good image compression, even for photographs that don't seem to have the kinds of self-similar structure shown by simple IFS factals.[6] 分割迭代函数系统 PIFS(partitioned iterated function systems)，也叫局部迭代函数系统，给出了令人惊讶的良好的图像压缩效果，即使是对于那些看起来不具有简单的IFS factals所显示的自相似结构的照片。

## The inverse problem 逆问题

Very fast algorithms exist to generate an image from a set of IFS or PIFS parameters. It is faster and requires much less storage space to store a description of how it was created, transmit that description to a destination device, and regenerate that image anew on the destination device, than to store and transmit the color of each pixel in the image.[5] 有非常快速的算法可以从一组IFS或PIFS参数生成图像。与存储和传输图像中每个像素的颜色相比，存储描述如何创建图像、将该描述传输到目标设备并在目标设备上重新生成图像的速度更快，所需的存储空间也更小。 The 逆问题 inverse problem is more difficult: given some original arbitrary digital image such as a digital photograph, try to find a set of IFS parameters which, when evaluated by iteration, produces another image visually similar to the original.In 1989, Arnaud Jacquin presented a solution to a restricted form of the inverse problem using only PIFS; the general form of the inverse problem remains unsolved. [7][8][5] 逆问题比较困难：给定一些原始的任意数字图像，如一张数字照片，试图找到一组IFS参数，通过迭代评估后，产生另一幅与原始图像视觉上相似的图像。在1989年，Arnaud Jacquin 提出了一个只用 PIFS 的限制形式的反问题的解，反问题的一般形式仍未解决。并由迈克尔 · 巴恩斯利的著作《分形无处不在》而流行开来。1992年，斯科特 · 德拉维斯发明了分形火焰算法。 As of 1995, all fractal compression software is based on Jacquin's approach.[8] 截至1995年，所有分形压缩软件都是基于Jacquin的方法。

## Examples 范例

The diagram shows the construction on an IFS from two affine functions. The functions are represented by their effect on the bi-unit square (the function transforms the outlined square into the shaded square). The combination of the two functions forms the Hutchinson operator. Three iterations of the operator are shown, and then the final image is of the fixed point, the final fractal. 该图显示了两个仿射函数在IFS上的构造。这两个函数用它们对双单位正方形的影响来表示（函数将轮廓正方形转化为阴影正方形）。两个函数的组合形成Hutchinson算子。图中显示了该算子的三次迭代，然后是定点的最终图像，即最终的分形。 Early examples of fractals which may be generated by an IFS include the Cantor set, first described in 1884; and de Rham curves, a type of self-similar curve described by Georges de Rham in 1957. IFS可以生成分形的早期例子包括Cantor set，最早描述于1884年；de Rham curveGeorges de Rham在1957年描述的一种自相似曲线。

## 参考文献

1. Zobrist, George Winston; Chaman Sabharwal (1992). Progress in Computer Graphics: Volume 1. Intellect Books. p. 135. ISBN 9780893916510. Retrieved 7 May 2017.
2. Michael Barnsley (1988). Fractals Everywhere, p.82. Academic Press, Inc
3. M. Barnsley, A. Vince, The Chaos Game on a General Iterated Function System
4. Draves, Scott; Erik Reckase (July 2007). "The Fractal Flame Algorithm" (PDF). Archived from the original (pdf) on 2008-05-09. Retrieved 2008-07-17.
5. Bruno Lacroix. "Fractal Image Compression". 1998.
6. Fischer, Yuval (1992-08-12). Przemyslaw Prusinkiewicz (ed.). SIGGRAPH'92 course notes - Fractal Image Compression (PDF). SIGGRAPH. Fractals - From Folk Art to Hyperreality. ACM SIGGRAPH.
7. Dietmar Saupe, Raouf Hamzaoui. "A Review of the Fractal Image Compression Literature".