1
$\begingroup$

I would like to ask your help with this problem I have to use Nest.

Checking the code that shared @Sascha in this thread Generate landscape by cutting a plane, I am trying to do in the pc the part that says Advanced usage, but the problem is that I do not know how to use Nest with the step function of that section, since you can not put

Nest[Step, RandomVariate[0, 0.02], 0, 1500]

because I am getting error, maybe someone from you can clarify me how to do the 1500 iterations that are mentioned in that thread.

$\endgroup$
4
$\begingroup$

There is a big difference between the built-in function Step and Sascha's function step.

step[dist_][prev_] :=
  With[
     {stepsize := RandomVariate[dist],
      rand := RandomReal[{-1, 1}]},
    prev + stepsize Sign[rand x + rand y + rand]]

SeedRandom[9];
Plot3D[
  Evaluate @ Nest[step[NormalDistribution[0, 1]], 0, 1500], {x, -1, 1}, {y, -1, 1},
  ColorFunction -> "GreenBrownTerrain",
  Boxed -> False,
  Exclusions -> None,
  BoundaryStyle -> None,
  Axes -> None,
  Mesh -> None]

plot

Edit

I have changed the plot options. The final effect is to give a more eroded look to the terrain, more Appalachians than Alps. It also plots much faster because exclusions are not being considered.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much for your quick response, it is true that it is faster, but I really like the finished Sascha I mean the crumpled or embossed landscape, to achieve it I must take into account Exclusions? $\endgroup$ – bullitohappy Feb 24 '17 at 17:43
  • $\begingroup$ @user1935664. Sasha did not reveal the details of how he plotted his landscape. I have not been able to find the options which reproduce the the look he gets. I believe he must have specified some options concerning exceptions, but don't know what they were. $\endgroup$ – m_goldberg Feb 24 '17 at 23:06
  • $\begingroup$ I have been very clear the reason about the null information of Sascha for the construction of the landscape, thanks for the help of Nest $\endgroup$ – bullitohappy Feb 25 '17 at 3:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.