# Epidemic simulation with a polygon container

**URL:** <https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523>\
**Category:** Staff Picks\
**Tags:** biological-sciences, data-science, medical-sciences, geometry, interface-construction, modeling, statistics-and-probability, geography, staff-pick, living-systems\
**Created:** [March 18, 2020, 1:05am UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523 "2020-03-18T01:05:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![franciscoj](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/franciscoj/32/35674_2.png) [@franciscoj](https://community.wolfram.com/u/franciscoj)\
**Post date:** [March 18, 2020, 1:05am UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/1 "2020-03-18T01:05:06Z")

</div>

_MODERATOR NOTE: coronavirus resources & updates:_ [https://wolfr.am/coronavirus](https://wolfr.am/coronavirus)

* * *

![3687ezgif.com-optimize.gif](https://global.discourse-cdn.com/wolfram/original/3X/e/e/eecc62d91e0c9477007a4b6a13afdaac08b5e5ef.gif)

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/c443430b-2f0e-461a-ad95-801016802147)

---

<div class="post-metadata">

**Author:** ![mfroeling](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mfroeling/32/23010_2.png) [@mfroeling](https://community.wolfram.com/u/mfroeling)\
**Post date:** [March 18, 2020, 12:55pm UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/2 "2020-03-18T12:55:49Z")

</div>

Very nice simulation, very interesting to play around with.

I think in your function createPosition one line should be changed to

```
DeleteDuplicates[
           Join[positions, 
            Select[Round@RandomPoint[region, n - Length[positions]], 
             memberq]]];

```

in stead of

```
DeleteDuplicates[
           Join[positions, 
            Select[Round@RandomPoint[region, 200 - Length[positions]], 
             memberq]]];

```

---

<div class="post-metadata">

**Author:** ![mfroeling](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mfroeling/32/23010_2.png) [@mfroeling](https://community.wolfram.com/u/mfroeling)\
**Post date:** [March 18, 2020, 12:57pm UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/3 "2020-03-18T12:57:46Z")

</div>

Very nice simulation, very interesting to play around with.

I think in your function createPosition one line should be changed to

```
DeleteDuplicates[
           Join[positions, 
            Select[Round@RandomPoint[region, n - Length[positions]], 
             memberq]]];

```

in stead of

```
DeleteDuplicates[
           Join[positions, 
            Select[Round@RandomPoint[region, 200 - Length[positions]], 
             memberq]]];

```

---

<div class="post-metadata">

**Author:** ![franciscoj](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/franciscoj/32/35674_2.png) [@franciscoj](https://community.wolfram.com/u/franciscoj)\
**Post date:** [March 18, 2020, 3:12pm UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/4 "2020-03-18T15:12:20Z")

</div>

Thanks for reporting it, I will fix it!

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [March 18, 2020, 5:29pm UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/5 "2020-03-18T17:29:39Z")

</div>

![news-congrads-kkluyshnik-02-04-19.jpg](https://global.discourse-cdn.com/wolfram/original/3X/6/a/6a310c2d0904616faf4e6e148260c9f29ab9f4eb.jpeg) – you have earned _ **Featured Contributor Badge** _ ![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

Your exceptional post has been selected for our editorial column _ **Staff Picks** _ [http://wolfr.am/StaffPicks](http://wolfr.am/StaffPicks) and [Your Profile](http://community.wolfram.com/web/franciscoj) is now distinguished by a _ **Featured Contributor Badge** _ and is displayed on the [Featured Contributor Board](https://community.wolfram.com/people). Thank you, keep it coming, and consider contributing to the [The Notebook Archive](http://notebookarchive.org)!

---

<div class="post-metadata">

**Author:** ![mathought](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mathought](https://community.wolfram.com/u/mathought)\
**Post date:** [July 29, 2021, 9:53pm UTC](https://community.wolfram.com/t/epidemic-simulation-with-a-polygon-container/15523/6 "2021-07-29T21:53:02Z")

</div>

It is a very good resource. I applied this model to my country.
