怎么拟合一条曲线?
1、把三角形离散化,得到三角形边界上的若干点:
pts = Flatten[{{{{0, 0}}},
Table[{{0, n/m}, {n/m, (m - n)/m}, {(m - n)/m, 0}}, {n, 1, m, 1}] //
Transpose}, 2]
当m=6的时候,相当于把每条边分割为6段。

2、当m=36的时候,相当于每边分割为36段:
Graphics[{Line[pts],Point[pts]}}]

3、对诸点的坐标进行Fourier变换:
f = Chop[Fourier[pts]]

4、只选取前面一半的数据:
f = Chop[Fourier[pts]][[1;; Ceiling[Length[pts]/2]]]

5、对数据f进行如下处理:
g=(2 Abs[f] Sin[π/2 - Arg[f] + 2. Pi Range[0, Length[f] - 1] t])/Sqrt[n]

6、对数据g进行有理化处理,误差是0.01。
h=Rationalize[g, 0.01]

7、求和,可以得到参数方程:
fc = h // Total

8、这样,可以把原三角形和fc画到一起:
Graphics[{ParametricPlot[fc, {t, 0, 1}][[1, 1, 3, 1, 2]], Line[pts]}]

9、把fc的图像绕原点旋转45°:
fc=RotationTransform[45°][fc];
Graphics[{ParametricPlot[fc, {t, 0, 1}][[1, 1, 3, 1, 2]], Line[pts]}]

10、再缩小fc的大小:
fc=fc/5;
Graphics[{ParametricPlot[fc, {t, 0, 1}][[1, 1, 3, 1, 2]], Line[pts]}]
哈哈,看起来还是蛮像的。
注意,上面的fc对应的,是把原来的三角形的每条边分成36份。

11、如果m等于2,那么,图像是:

12、放大fc的图像,也没用。
由此可见,原三角形分割的份数越多,fc与三角形的形状越接近。
