Talk:Population dynamics

From Puella Magi Wiki
Jump to navigation Jump to search
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. 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? ([math]\textstyle{ {C \over {B+D} } }[/math], [math]\textstyle{C \left( {{B-K} \over {B+D}} \right)}[/math], ...). Maybe we should put somewhere what they represent, because as-is they're not really relevant ... --Homerun-chan 16:56, 13 April 2011 (UTC)

Twitter and IRC corrections

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?

Original 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?

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

--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 [math]\Delta W = F * W(t) + ... [/math], 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 ...

Original tweet

--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:

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

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 plugin, so I had to go with lolgoogle translate. Anyway, hopefully someone will understand what it says:

Original tweet

--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. 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. -- 06:54, 28 March 2011 (BST)


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: 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 [math] - K \times M(t) \times W(t) [/math] is a better model for the death of witches than either the simple model ([math] - K \times M(t) [/math]) or the refined model ([math] - K \times \mathrm{Min}(W(t), M(t))[/math].) -- 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)


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

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


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 [math]W(t) \gt M(t)_{t \rightarrow \infty}[/math] 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)

See also

Experimental results are being discussed here --Homerun-chan 18:10, 20 March 2011 (UTC)

After the Finale

In the finale, Madoka "changed the fundamental laws of nature" by "wishing to remove magic girls before they ever become witches." In terms of our models, the essential effect of this wish removes B*M(t) component from our differential equations. Are there any model that are capable of provide for an sustainable W(t) (for magical creatures) population even when B*M(t) are removed? Prima 17:11, 22 April 2011 (UTC)

Why do you want to model the population dynamics after the ending, i.e. when one of the populations disappeared? Basically, even if QBe continues generating MSes (but he'd have no reason to since they wouldn't become witches), no MS would become a witch anymore, so in the end W(t) stays at zero and M(t) grows linearly, that's all. --Homerun-chan 17:21, 22 April 2011 (UTC)
I suppose you're right. There's nothing in the witch population model that carries over for magical creatures. Prima 17:37, 22 April 2011 (UTC)
Just rewatched episode 12 (in fact, I paid attention to it for the first time), so I should correct myself: apparently, there are still Magical Girls in the new world, and they are still fighting, but this time MSes and "magical beast" do not interact in any other way than fighting each other. That looks like a regular Lotka-Volterra system to me. --Homerun-chan 19:34, 22 April 2011 (UTC)

We have been outdoned - Prima 07:58, 11 August 2013 (UTC)