Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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).

share|improve this question
1  
Can you post your code so we'll have a starting point? Also are your craters just circles in the graphics? –  Vitaliy Kaurov Nov 17 '13 at 0:59
    
@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). –  Benjamin L Nov 17 '13 at 1:48
    
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 –  Vitaliy Kaurov Nov 17 '13 at 2:05
add comment

2 Answers

up vote 7 down vote accepted

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[{PointSize@.05, Point@#}, ImageSize -> 230,  PlotRange -> 300, Frame -> True], 
      ListLinePlot[AppendTo[number, Length@#], PlotRange -> All, ImageSize -> {Automatic, 210}, 
                                                                            Frame -> True]}]) &@
 (Join[{#}, Complement[craters, Nearest[craters, #, {Infinity, 30}]]] &@  RandomReal[{-250, 250}, 2])
]

Mathematica graphics

share|improve this answer
    
+1 very neat, is example of this syntax {Infinity, 30} in documentation on Nearest? –  Vitaliy Kaurov Nov 18 '13 at 2:44
    
@VitaliyKaurov I used this reference.wolfram.com/mathematica/tutorial/UsingNearest.html, and probably some remembrance of a previous answer in this site –  belisarius Nov 18 '13 at 3:06
add comment

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

share|improve this answer
    
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. –  Benjamin L Nov 17 '13 at 2:06
    
@BenjaminL Updated. History is stored in variable 'number'. –  Vitaliy Kaurov Nov 17 '13 at 2:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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