MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Epidemic Model

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105821] Epidemic Model
  • From: Osman Tuna <osmantunagokgoz at yahoo.com>
  • Date: Sun, 20 Dec 2009 06:55:42 -0500 (EST)

I wrote a code to show simplified epidemic spreading, but there is a problem, I want to see 100, 150, 200... steps for same epidemics, in this code for every loop, only starting point is same, first, second, third... steps have new values, how can I see 150th steps which starts from 100th step value of same epidemics?


Manipulate[
 SeedRandom[seed];
 (* Let's choose initial condition *)
 mylist = Table[RandomInteger[{20, p}], {RandomInteger[{10, r}]}];
 
 For[mylist; n = 0, n < q (* q determines the number of steps *), n++,
  (* Let's decide how these illnesses spread or disappear *)
  mylist = ReplacePart[mylist, 
    RandomChoice[mylist -> Table[i, {i, Length[mylist]}], 1][[1]] -> 
     mylist[[RandomChoice[mylist -> Table[i, {i, Length[mylist]}], 
         1][[1]]]] +(* 
      Now decide how the number of infected people change, 
      it can decrease because of death or recovering from the illness \
*)RandomInteger[{-5, 10}]]];
 
 ListLogLogPlot[Reverse[Sort[mylist]], AxesOrigin -> Automatic, 
  Joined -> True, 
  AxesLabel -> {"epidemic types", "infected people"}], {{p, 60, 
   "infected people"}, 40, 80, 5, 
  Appearance -> "Labeled"}, {{r, 30, "epidemic types"}, 20, 50, 5, 
  Appearance -> "Labeled"}, {{q, 250, "steps in epidemic"}, 100, 500, 
  50, ControlType -> Setter},
 {{seed, 1, ""}, Button["random seed", seed = RandomInteger[1000]] &},
 TrackedSymbols -> {p, r, q, seed}
 ]


  • Prev by Date: Re: CellChangeTimes?
  • Next by Date: Julias from Pc type polynomial solutions for n=2 the Mandelbulb
  • Previous by thread: Re: FindFit constrains when parameters are in table
  • Next by thread: Julias from Pc type polynomial solutions for n=2 the Mandelbulb