10
$\begingroup$

I have been trying to model crater formation on a given planetary surface - $500\,\textrm{km}^2$. The locations of impacts are random, however, if an impact is within $30\,\textrm{km}$ of another, the previous crater is considered eliminated.

So far I have used RandomReal[0,500] for both the $x$ any $y$ coordinate values on the $500\,\textrm{km}^2$ plot. My problem is that the arrangement of craters changes for every evaluation I do. What I'm looking to achieve is a cumulation of craters, one by one."Drawn on" so to speak. This way, appropriate crater destruction can also ensue.

I am also still trying to figure out a way to model crater destruction. As I mentioned, if an impact location is within $30\,\textrm{km}$ of another, the previous crater is eliminated. I tried using If[EuclideanDistance[],...] but no luck.

The code I used for crater location (points) is:

    craterlocations = Table[{RandomReal[{0, 500}], RandomReal[{0, 500}]}, {n}]
    p1 = ListPlot[craterlocations]

I need to produce a similar plot, but the craters should continually form. As of now I will always wind up with a different random arrangement for each number of impacts (n).

$\endgroup$
3
  • 1
    $\begingroup$ Can you post your code so we'll have a starting point? Also are your craters just circles in the graphics? $\endgroup$ Commented Nov 17, 2013 at 0:59
  • $\begingroup$ @VitaliyKaurov , for the purpose of modeling, points work fine. A crater is considered destroyed when its center is covered by a new one. That translates to a point proximity of 30km (crater radius). $\endgroup$
    – Benjamin L
    Commented Nov 17, 2013 at 1:48
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign $\endgroup$ Commented Nov 17, 2013 at 2:05

2 Answers 2

8
$\begingroup$

Very similar to Vitaliy's answer, but deleting all craters within the critical distance, and somewhat more compact:

craters = {{0, 0}};
number = {1};
Dynamic[
 (craters = #;
  Row[{
  Graphics[{[email protected], Point@#}, ImageSize-> 230,  PlotRange-> 300, Frame-> True],
  ListLinePlot[AppendTo[number, Length@#], PlotRange -> All, 
               ImageSize -> {Automatic, 210}, Frame -> True]}]) &@
 (Join[{#},Complement[craters, Nearest[craters, #, {∞,30}]]]&@ RandomReal[250{-1, 1}, 2])
]

Mathematica graphics

$\endgroup$
2
13
$\begingroup$

This is simplest implementation. If a new crater gets closer than 30 to some old craters, only closest old crater is getting replaced with new one. You can built on this example something more sophisticated.

craters = {{0, 0}};
number = {1};
Dynamic[new = RandomReal[{-250, 250}, 2];
 near = Nearest[craters, new][[1]];

 Row[{
   Graphics[{PointSize[.05], 
     Point[craters = 
       If[EuclideanDistance[near, new] < 30, 
        craters[[Position[craters, near][[1, 1]]]] = new; craters, 
        craters~Join~{new}]]}, ImageSize -> 230, PlotRange -> 300, 
    Frame -> True],

   ListPlot[number = number~Join~{Length[craters]}, 
    ImageSize -> {Automatic, 210}, Frame -> True]
   }]
 ]

enter image description here

$\endgroup$
2
  • $\begingroup$ Vitaliy, Thanks for the help. This is what I was going for. How could I find the number of craters after a certain time step? In other words, if a crater hits every 1000 years, how could I see the number of craters (or density) as a function of time? I don't see anything related to the rate or number of impacts in the code. $\endgroup$
    – Benjamin L
    Commented Nov 17, 2013 at 2:06
  • $\begingroup$ @BenjaminL Updated. History is stored in variable 'number'. $\endgroup$ Commented Nov 17, 2013 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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