萌新求助
mathematica吧
全部回复
仅看楼主
level 1
EGOFkkk 楼主
In this task of Mathematia, we will write a few codes to simulate the fractals, see the wiki page (Links to an external site.)Links to an external site. for a short introduction. We implement the plotting in following steps. Please submit all functions in one notebook.
1. Write a function to simulate following computation. Give a 4-tuple {x,y,z,w}. Your function's name is called Iter[{x_, y_, z_, w_}], the output is a list as {x^2 - y^2 + z, 2xy + w, z, w}.
2. Write a function called Stop[{x_,y_, z_, w_}], it outputs True if x's absolute value is not exceeding 100, otherwise outputs False.
3. Write a function called Vacant[{x_,y_,z_, w_}], it repeatedly apply Iter to the input, if in 50 rounds, the Stop function does NOT give a True, then this function outputs a True, otherwise it outputs a False.
4. Use the following function to get Pts and plot Pts with ListPlot function.
Pts = {}
z = -0.8; w = 0.156;
For[i = -280, i < 280, i = i + 5,
For[j = -100, j < 100, j = j + 5,
If[! Vacant[{i/200, j/100, z, w}],
Pts = Append[Pts, {i/200, j/100}]
];
]
]
上面是问题然后我第三个实在是不知道 求大神
Iter[{x_, y_, z_, w_}] := {x^2 - y^2 + z, 2*x*y + w, z, w}
Stop[{x_, y_, z_, w_}] := Abs[x] <= 100
Vacant[{x_, y_, z_, w_}] :=
NestWhile[Iter, {x, y, z, w}, Stop == False, 50]
2018年11月21日 23点11分 1
1