# Talk:Population dynamics

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Note: Please always sign your name when editing talk page by putting four tildes (~~~~) at the end of your comment.
Previous discussions are archived at:

## Japanese translations

Since quite a lot of our japanese colleagues seem to want a translation, here's what I found so far:

(comes directly from random tweets).
Hope it helps --Homerun-chan 15:24, 24 April 2011 (UTC)

## Simulations and graphs

I feel that you should add the assumed numbers right above the graphs, because those will affect greatly how the graphs turn out, and I think that putting the numbers up front will enable readers to agree with your starting numbers first.220.255.2.142 13:36, 19 March 2011 (UTC)

Thanks for the advice, adding it right now. Also, note that they are in the image's description field. --Homerun-chan 13:45, 19 March 2011 (UTC)

Just wondering, what are those numbers that appeared below the constants in the simulation tables? ($\textstyle{ {C \over {B+D} } }$, $\textstyle{C \left( {{B-K} \over {B+D}} \right)}$, ...). Maybe we should put somewhere what they represent, because as-is they're not really relevant ... --Homerun-chan 16:56, 13 April 2011 (UTC)

Along with the other tweets, I found this one that seemed interresting, but I'm not sure I understand it. Basically, they're saying the refined model only works when F+B+1-K>0?

aiberyOriginal tweet Refined modelで魔女が増加するのは F+B+1-K>0 の時だけのような気がするけど、たぶん私が間違ってるんだろう。discussionではmatrixまで用いられてて文系にはちとキツい。Refined modelで魔女が増加するのは F+B+1-K>0 の時だけのような気がするけど、たぶん私が間違ってるんだろう。discussionではmatrixまで用いられてて文系にはちとキツい。

It might be nice to investigate it a little, or explain why it is the case if you know... --Homerun-chan 17:48, 19 March 2011 (UTC)

It is a stumbling block I located as well.
In the case when M(t) > W(t), ΔW=(F+B-K)W, that is, change in witch population depends solely on the current population, modified by the constant (F+B-K). If F+B-K is negative, then ΔW is negative, and the population spirals downwards to zero, and M becomes a linear function Ct. The population dynamics breaks down. The only way to avoid this is if F+B-K is nonegative, but I am not certain how we can justify it, unless we call Kyuubey as a rational agent again. Prima 17:57, 19 March 2011 (UTC)
Actually, it's just a logical consequence of our model. If we change the hypotheses so that soul gems dim over time, we should fall back to a working model. I wouldn't do it though, since there has been no proof of that in canon, and it means setting a model to show us what we want to show, instead of solving the inconsistency at its source. --Homerun-chan 18:20, 19 March 2011 (UTC)
It's a interesting thought, with the refined modeled, the witch population either is always increasing or always decreasing, as long as it is smaller than the magical girls population. If we also include dimming, both populations has the additional potential to simulatenously stabilized, but also with the caveat that the witch population is less than the magical girls population. This implies that unlike the simple model, both refinements have significant dependence on actual variable values. Prima 14:59, 20 March 2011 (UTC)
if the simulation graph shows a linear Ct, wouldn't it means, no magical girls dies naturally?which is rather impossible.
if there's 500 magical girls, 0.2 populations of magical girls dies naturally (100 magical girls dies), and on each loop kyuubey ::::recruit 100 new magical girl on each loop, it should be evident that magical girls population wouldn't increase any further.SiestaMadokaist 16:17, 4 December 2012 (UTC)SiestaMadokaist

Another tweet I found but I don't understand. Basically, if I got it right, this person asked their professor to look into it and they have some ideas of corrections to make?

goodhuntstalkerOriginal tweet これについて私が私淑する師匠は「tの函数だとおかしいところが出てくる？ まあそのうち式も修正されるにちがいない」と。さすがフマクティとスケルトンの数について数学的証明をしただけの（ｒｙこれについて私が私淑する師匠は「tの函数だとおかしいところが出てくる？ まあそのうち式も修正されるにちがいない」と。さすがフマクティとスケルトンの数について数学的証明をしただけの（ｒｙ

--Homerun-chan 16:30, 23 March 2011 (UTC)

Interresting remark from the IRC: when a witch is killed, do her familiars disappear as well? (at least the ones that didn't achieve maturation). And the subsequent question: is it taken into account in our models? I'd say "yes" to both questions since $\Delta W = F * W(t) + ...$, but I'm not sure so external opinions would be welcome. --Homerun-chan 13:29, 25 March 2011 (UTC)

There's no clean cut answer since we don't actually model the familiar population. I suppose the best interpretation is that since F*W(t) is dependent on witch numbers, all familiars die when their witch was killed. What if this isn't true? How can we adjust the model to account for this? Prima 16:42, 25 March 2011 (UTC)

Damn my poor skills at japanese. Isn't this tweet saying something interresting? If anybody could translate it, or at least tell us if it says anything new ...

--Homerun-chan 19:12, 16 April 2011 (UTC)

According to my Rikaichan skills, it says: This is great. Well done LOL, but I dare to say, the state change diagram seems wrong. Because witches are not turning back into magical girls upon death, the K state change should not link dead with M(t). The equations are correct. --KFYatek 19:26, 16 April 2011 (UTC)

There's another tweet by the same author, with my transguesslation attempt:

KC_nishidaOriginal tweet If we put this analysis into practical use, at a given time t, total amount of extracted energy equals an integral over that time t of: population of magical girls * probability of turning into a witch * amount of energy Kyubey extracts in a unit of time. In short, E=∫(M(t)*B*ΔE)dt. It looks like a great source of energy, compared to a nuclear power plant.この解析を応用すれば、時間ｔでの魔法少女の個体数×魔女への状態遷移確率×エネルギー抽出量でＱＢが時間当たりに抽出するエネルギー量、さらにそれを時間ｔで積分すれば、エネルギーの総抽出量が計算できるね。つまり、E=∫(M(t)*B*ΔE)dtだな。原発よりいいエネルギー源になりそうｗ

This time nothing interesting here. But translated just in case someone wonders what's there. --KFYatek 00:38, 17 April 2011 (UTC)

Oh god, this can be done. Oh God! You're John Nash, right? I've been studying your equilibrium. To come up with something totally original the way you did... I've been developing a theory. I believe I can show that Galois extensions are covering spaces. Prima 09:47, 17 April 2011 (UTC)
One of these days we're gonna discover the Theory of Everything if we go on like that ... --Homerun-chan 10:13, 17 April 2011 (UTC)

Yet another tweet that seems interresting, but to make it worse than usual I don't even have access to the jisho.org plugin, so I had to go with lolgoogle translate. Anyway, hopefully someone will understand what it says:

nekosanOriginal tweet 要するに自明なアトラクタに陥らない解集合に対応するパラメタ領域を探し求める試行を数限りなく繰り返したけど、結局は元の微分方程式に対応するdynamicsが書き換わることで解決が図られたというわけなんだな、たぶん要するに自明なアトラクタに陥らない解集合に対応するパラメタ領域を探し求める試行を数限りなく繰り返したけど、結局は元の微分方程式に対応するdynamicsが書き換わることで解決が図られたというわけなんだな、たぶん

--Homerun-chan 20:02, 2 May 2011 (UTC)

## Thoughts for exploration

If you were willing to use a more complicated simulation, here are some thoughts.

• First, you could model the fights themselves. Each fight would end in either a Win, Draw, or Loss for the magical girl. With a loss, the magical girl dies, requardless if the other combatant was a witch or a familiar. With a draw, the girl expends some energy, again reguardless of the opponent (and perhaps my be unable to fight for a couple of iterations). Winning is different though, as if the magical girl wins against a familiar, she still merely expends energy, while against a witch she's able to recharge. On the other hand, if a familiar has enough battles in its favor, it becomes a witch.
• Second, you can have the probabilities of each iteration feed back on themselves, with draws reducing the chances for future wins and wins increasing them.
• Third, you can make some assumptions about how long each girl has, from a bit a extrapolation. Something like each magical girl has 100 units of energy (life force) available when she makes the contract, and each fight uses up 10 units, and if she doesn't find an opponent, she uses up 1 unit. If a magical girl's enery runs out, she becomes a witch.
• Fourth, you can insert some randomness into each value to give some acknowledgement to the quirks of each fight. The only thing to determine is how likely it is for magical girls to fight witches and/or familiars in a given iteration. A simple way would be for a magical girl to have a 1% chance of finding a given witch or familiar, and check against all of them. You could assume that a magical girl could kill 1 enemy per iteration, or have that change with the number of victories she has.
• Fifth, you could stipulate that if a witch has a battle in its favor or doesn't fight a magical girl at all for that iteration, it generates a familiar.
• So, the change in population would be the net (summation) of all the fights between magical girls and familiars.

Kylone 15:40, 21 March 2011 (UTC)

I think these changes will move this project beyond the realm of population modeling to life simulation. I think there's some interesting ideas here though: Is it proper for the modeling to assume that all MS and Witches have the same K, B, D, F rate, regardless of age? It's obvious from the show that veterans have higher survival rate than newbies, and older witches are tougher than newer ones. It's possible to pseudo-account for this in modeling if we change the dependences not just on M[t] & W[t], but also on M[t-1] & W[t-1], how it will effect the outcome is not something I can possibly analyze by hand.
While we know that some witches are tougher than others, it doesn't necessarily correlate with age. For all we know, older witches get crazier and more self-absorbed and become less effective in combat. Oktavia von Seckendorff (Sayaka) seemed to be an unusually tough opponent (although her opponents in both episodes 9 and 10 probably weren't fighting their best), despite being only a day or two old and born from a young inexperienced magical girl. 86.13.224.153 19:37, 21 March 2011 (UTC)
Additionally, I'd like to point out an issue with the first point in the list. Familiars don't become Witches by winning fights, they "evolve" by eating a certain number of humans. I think the strength of a witch might also be partially dependent on the number of humans it has consumed, but also on a number of other factors, such as the strength of their curse (Sayaka), and the innate potential originally possessed by the magical girl(Madoka). Perhaps witches born from familiars are initially weaker than those born directly from magical girls, so their strength depends more on how many humans they've eaten than those whose grief seed came from a soul gem?Jorlem 20:32, 21 March 2011 (UTC)
However, I think all of us that edits this page have been quite burnt out at this point to try out these changes, so don't expect any work on this for quite some time. Prima 16:08, 21 March 2011 (UTC)
Actually, I like your approach. It's not really modeling (it's more like a live simulation as prima said), but it might be interresting to try, just out of curiosity. The main concern of your approach is that it relies on a lot of variables we have to extrapolate/think up. It's gonna be hard to find realistic values that give an interpretable result (just see the problems we already have with the time-based model ...) --Homerun-chan 16:24, 21 March 2011 (UTC)

Now that I have access to the "real" Matlab (not FreeMat) and Simulink, I'll try to make a more detailed analysis of the last model which we expected to be chaotic ... As soon as I find out how to use the min() function in Simulink's differential equations editor --Homerun-chan 09:03, 21 May 2011 (UTC)

## F, C, D/B are dynamic; Witches can be revived as necessary

• Familiar-to-witch conversion rate decreases as the number of witches relative to the number of humans increases due to competition for "food"/saturation in a city being reached.
• QB's recruitment rate is obviously situation-dependent as he'll only recruit as many magical girls as he needs. If there are many witches around he may recruit more. If there are few around he might recruit extremely instable girls who will turn into witches soon. And he will also try to keep the number of magical girls low to avoid an entire army of MGs marching around, that would get too much attention
• If there are plenty of witches around then MGs can also hunt for the weakest ones first to gather soulpower, thus decreasing their conversion rate (decreases B) and avoiding deaths (decreases D)

The system is not instable at all, it's self-regulating. If there are too many MG's QB can just stop recruiting and wait until they turn one way or another. He can also release one of his stored grief seeds and resurrect a witch by saturating the seed with additional grief. See episode 3. If there are too many witches their self-replication via F gets decreases since they are competing for food, humans. --91.16.15.53 06:54, 28 March 2011 (BST)

## Zombies

Just realized that this could be slightly modified for zombies. Thoughts? MAHO☆KYOKO 04:34, 29 March 2011 (BST)

Also vampires. MAHO☆KYOKO 08:30, 30 March 2011 (BST)
You might be interested in this study on zombie population modeling: http://mysite.science.uottawa.ca/rsmith43/Zombies.pdf Prima 03:59, 31 March 2011 (UTC)
I also thought about zombie population modeling given the similarities between both models. I've been a little lazy lately (and busy with real-life stuff too) so I didn't take the time to go and look for the articles on the subject, but it was on my todo-list ... Maybe I'll try and adapt it one of these days if I find the time and motivation, just in case we get different results from what is already on the page. --Homerun-chan 10:18, 31 March 2011 (UTC)

## Reaction Kinetics

• The speed of a reaction depends on the concentration of the reactants. Assuming that the distribution of both magical girls and witches are uniform, I think $- K \times M(t) \times W(t)$ is a better model for the death of witches than either the simple model ($- K \times M(t)$) or the refined model ($- K \times \mathrm{Min}(W(t), M(t))$.) --24.23.181.131 01:19, 17 April 2011 (UTC) Amaki
Gotta read up on rate equations, but I do think this is a valid refinement to the models. Prima 09:52, 17 April 2011 (UTC)

## Full pop dynamics model

I came up with a model which I believe better predicts the actions of Puellae Magi/Magical Girls, Witches, and Kyubey.

The model:

M(t+1) = M(t) + C + I*W(t) - B*M(t) - K*M(t)*W(t)

W(t+1) = W(t) + B*M(t) + F*(W(t)-H*M(t)) - S*M(t)*W(t)

Variables:

M(t) = number of Puellae Magi/Magical Girls alive at time t.

W(t) = number of Witches alive at time t.

Parameters:

C = number of girls who contract with Kyubey in a given area and time, as a base (this is needed to lift the populations from 0).

I = increment to number of girls who contract based on number of Witches (as encounters with witches are usually how he gets his claws in)

B = rate at which Puellae Magi/Magical Girls mature into Witches (largely independent of number of Witches, since the magic expended fighting them is regained by use of Grief Seeds)

K = rate at which Puellae Magi/Magical Girls are killed by Witches (only other Magical Girls and Witches have a hope of killing one thanks to their effective lichdom, and generally they avoid fighting each other - if you wanted you could add an additional quadratic term in M(t) to represent territorial rivalry)

F = rate at which Witches propagate due to familiars without the intervention of Puellae Magi/Magical Girls.

H = average heroism of Puellae Magi/Magical Girls, expressed as the number of witches they can suppress familiar reproduction from. It's called heroism because only "heroic" Puellae Magi/Magical Girls like Sayaka and Mami engage in this, whereas "pragmatic" Puellae Magi/Magical Girls like Homura (kinda) and Kyouko do not.

S = rate at which witches are slain by Puellae Magi/Magical Girls. (as normal humans generally are unable to kill them)

Of note, with many sensible choices of parameters this model has stable solutions with more Witches than Puellae Magi/Magical Girls, as is apparently the case in the show.

Note that to scale this model up or down, one must modify the quadratic parameters K and S, as they are a result of density rather than absolute number. For each doubling of C (the only constant parameter), they must be halved.

Magic9mushroom 10:04, 19 July 2011 (UTC)

Rather fried at the moment, any chance you can run some simulations to get an idea how this model changes the population dynamics? - Prima 11:23, 19 July 2011 (UTC)
I ran it through Excel a bunch of times before putting it up. There are some sets of parameters that result in quickly-attained (within 20 iterations) stable solutions that persist indefinitely. There are others for which everything generally goes nuts (the quadratic terms can result in more witches being killed than there are witches to kill, or more magical girls dying than there are magical girls to die) but these are an artifact of running the simulation discretely AFAIK. Familiar reproduction can result in apocalypse for sufficiently large F and sufficiently small H, but will be contained by I kicking in (though, again, there are issues with running this discretely). The important parts for the stability of the solution are the quadratic terms and the existence of I to curb apocalypse - H is only provided for completeness and accuracy. Magic9mushroom 11:39, 19 July 2011 (UTC)
We'll need matlab for this one. I can try to work out some results on paper, but that'll be several days from now. - Prima 11:40, 19 July 2011 (UTC)
I have tried some model like this very much. Given that there be many familiars per witch and very low rate for them to become witches(so that number of witches won't grow exponentially), the factor H is really neglectable. Even every magical girl kills familiars like Sayaka, the number of witches won't significant decrease than nobody does that. Sayaka, you are really such a fool. Yorkwoo 06:19, 20 July 2011 (UTC)
Well, like I said, H is included for completeness. It does affect the steady state, though, decreasing the amount of witches and increasing the amount of magical girls.
H does affect the equilibrium, but it won't change the qualitative outcome AFAIK. If a set of values leads to a dominance of witches, then $W(t) \gt M(t)_{t \rightarrow \infty}$ no matter what the value for H is (as long as it's lower than 1 of course).
Also, could you give me the values you used and that gave a chaotic outcome? It may be related to my change with the C factor (see below), but I always get an equilibrium... --Homerun-chan 12:29, 24 July 2011 (UTC)
Ok, now I found whether H is important is depend on the contribution to # of witches from familiars. By carefully choosing the parameters, equilibrium can be ensured to prevent number of witches out of control. If most witches came from familiar (higher F value and lower B value), then killing familiars does help reducing number of witches. But I don't see many witches came from familiars in the anime. One of my results as an example may be viewed at here. The 4th and 5th columns are values with H=100%, while 6th and 7th columns are values with H=0%. More heroic MGs can help reduce witches and number of killed MGs, but also means more MGs become witches, so the outcome is still not much difference. Yorkwoo 14:19, 24 July 2011 (UTC)
If F is near the critical value to cause runaway, then obviously H is relevant, as a tiny change can cause huge differences in the result. Also, there is a constant threat of witches in Mitakihara (sp?) City, but only one MG is seen to turn over the course of the show, so the implication is that most witches do indeed come from familiars (the argument is that every single magical girl seen killed many witches, but a MG can produce a grand total of one witch via direct transformation, so most of those witches have to come from familiars assuming a steady state). Magic9mushroom 20:30, 24 July 2011 (UTC)

Now that I have a chance to sit down and look at this model, I think it's extremely sound in logic and should in some way be placed on population dynamics as the primary model. I still doesn't have a chance to analyze its full implications yet, but I hope user:Homerun-chan will run some matlab on this.

Did someone say "Matlab"? Cuz I think I herd someone say "Matlab"...
Anyway, I'm back home, so I'll make a script off it when I get the time (which will be a bit tricky since I'm working fulltime starting on Monday... Either I'll hijack one of their computer or do it on my free time). I just got back like 3 minutes ago so I didn't carefully read the model yet, but more model refinements is always bound to be a good thing :) --Homerun-chan 20:28, 23 July 2011 (UTC)

If we settle on this model, our next venue of research should be start proposing realistic numbers for the constants and variables. For example, we can dig through census datas and find the yearly rate of unidentified deaths and suicides, and infer certain numbers regarding witches from it. - Prima 06:40, 23 July 2011 (UTC)

Are you planning to infer the number of witches in the "real" world based on our models, instead of just analyzing qualitative data? Might be interesting, but also extremely tricky, as we have to guess and fine-tune most of the parameters in our equations --Homerun-chan 16:58, 24 July 2011 (UTC)
A bunch of the parameters can be estimated based on what we see in the show, for instance the K/S (D/K in your version) ratio based on the number of witches seen killed vs. the number of magical girls seen killed. With an established density of witches, the B/D ratio can also be established from the known proportions of magical girls that die vs. become witches. Magic9mushroom 20:30, 24 July 2011 (UTC)
We could do that, but that means implying values from a sample of 5 MSes and roughly 14 witches. I know this is the only data we have (excluding the manga spin-offs), but statistically speaking, that is a bit too few... --Homerun-chan 21:54, 24 July 2011 (UTC)

I think there's something odd with your model Magic9mushroom. Because of the I and C parameters, at each iteration, the number of MSes being contracted depends both on the number of witches, and on a constant term. In other words, that would mean Kyubey "randomly" chooses C girls, and also contracts I girls that were in contact with witches. I don't remember any canon element that would allow us to validate or debunk this assumption, but it seems more consistent to me that QBe only contracts girls that were approached by witches; so, I ran a script with only the C parameter for now, I'll modify it if needed as the conversation goes on. (Note: I also renamed your K as D, and your S as K, since that's the names we used in the previous models) --Homerun-chan 12:11, 24 July 2011 (UTC)

Well, Mami's and Kyouko's backstories imply they had no contact with witches prior to becoming Magical Girls (well, it's possible that Mami's accident was caused by a witch's curse, but there isn't much indication either way), so I'd say that it is indeed validated by canon. Additionally, I is crucially important, since it increases magical girl production (and thus attrition) when there are too many witches, making the model more stable. Magic9mushroom 20:30, 24 July 2011 (UTC)
Oh, also, looking at your results, I see that you've assumed 120 witches are killed in battle for every magical girl that is. Don't you think that's a bit much? Magic9mushroom 20:34, 24 July 2011 (UTC)
K=0.12 actually means that at each iteration, 12% of the total population of witches is killed by the whole population of MSes, if I'm not mistaken. That value may be wrong (as all the others, in fact), I chose it quite randomly based on previous models. Once again, it would help quite a lot if you could give me the values you used (those that gave a chaotic system in particular, but also one or two that led to an equilibrium), so that I can play with it a bit.
That is, before prima gives us realistic numbers based on US censuses and rainbow-colored suicide charts --Homerun-chan 21:54, 24 July 2011 (UTC)
You are mistaken. K = 0.12 means that each magical girl kills 12% of the entire witch population at every iteration. Unless you're running the model over a tiny area this is probably too large. The cases I got of an apocalyptic cycle were ones with high F (0.6 or so); the witches kill off the magical girls and grow out of control, upon which Kyubey contracts enough magical girls to result in 100% death rates for both sides. Magic9mushroom 00:18, 25 July 2011 (UTC)

I tried to come up with a model which better accounts for the fact that the aliens like Kyubey are free to change the number of girls they contract to adjust the numbers of witches and magical girls on my homepage: On the population dynamics of “Puella Magi Madoka Magica”, which might be of interest for this discussion. Jan Thor 18:47, 16 October 2011 (UTC)