Talk:Population dynamics: Difference between revisions

From Puella Magi Wiki
Jump to navigation Jump to search
Line 152: Line 152:


: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 ...) --[[User:Homerun-chan|Homerun-chan]] 16:24, 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 ...) --[[User:Homerun-chan|Homerun-chan]] 16:24, 21 March 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. --[[Special:Contributions/91.16.15.53|91.16.15.53]] 06:54, 28 March 2011 (BST)

Revision as of 05:54, 28 March 2011

refined model analysis

Based off one of my courses, I made a quick analysis of the refined model in terms of convergence and equilibrium. The theorems used are [citation needed] though since they're directly taken from said course's notes (and I only have references for the whole course). Plus I'm not sure the vocabulary is correct in English (translated from french). Please correct it if necessary.

Here goes:

Let's rename the variables for easier notation. x1 will be M(t) and x2 will be W(t). We can generalize the system as follows:

Population analysis, equation 1.png

Where a_ij is the contribution of population j to population i (so a12 is the effect witches have on magical girls, etc)

We can write this system using matrix notation:

Population dynamics, matrix notation.png

Where A and C are matrices containing the coefficients. To be exact, let A be

Population dynamics matrix A.png

And let C be

[math]\displaystyle{ C = \begin{bmatrix} c \\ 0 \end{bmatrix} }[/math]

The matrix C is constant and hence does not influence the results on stability/equilibrium.

We can prove that (first citation needed), it A's determinant is different than zero, then the only equilibrium for both M(t) and W(t) is when M(0) = 0 and W(0) = 0. (see observations on the page). The determinant of the matrix A is

Dynamics matrix5.png

Let us now discuss the stability, and other equilibria when det A yelds zero (i.e. B=K or D=-B).

Equilibrium

For the further analyses, we ignore Kyubey's contribution (i.e. the matrix C). Basically, adding it would transform an equilibrium into a linear function, and so on.

If det A = 0 (i.e. if (B=K or D=-B), then the only equilibrium is at M(0)=0 and W(0)=0 (no witch, no MG => they can't exist by themselves). Otherwise, [second citation needed], all the equilibria are the states so that

Population dynamics equilibrium.png

This equation could only be satisfied if D=-B. This is inconsistent with the model (neither the amoung of girls dying nor the amount of girls becoming witches could be negative), so we'll discard this result. Hence, the only equilibrium would be M(0)=0, W(0)=0 when K=B

Stability

The system is always unstable (i.e. inserting a small amount of witches from the "ideal situation" [ W(t) = 0 ] will result in the Earth being taken over), unless K>B; in that particular case, the system is asymptotically stable (i.e. introducing a small number of witches will result in no witches after a certain amount of time). I can provide a partial mathematical demonstration of that, but it's quite long and it uses eigenvalues and complex numbers (and, as usual, it lacks citations for the theorems used). Do you want me to post it, or do we go by rational logic ("if B>K, the number of witches appearing is higher than the number of witches dying, so introducing a small amount of witches will result in exponentionnal growth. Otherwise, every girl kills more witches than what appears, so introducing witches from a state of equilibrium will result in the extinction of said witches over time")

A third option would of course be for someone to find a closed form of the system, so that the stability can be easily found by taking t going to infinity. --Homerun-chan 23:08, 19 March 2011 (UTC)

The terrible nightmares of matrixes start flooding back. Just a thought, since we have a prop-function in how we define the differential equations, shouldn't the matrix A have corresponding changes in representation? That is, if M>W, [math]\displaystyle{ \textstyle {A= \begin{bmatrix} -(D+B) & 0 \\ B-K & F \end{bmatrix} } }[/math], if W>M, [math]\displaystyle{ \textstyle {A= \begin{bmatrix} 0 & -(D+B) \\ 0 & F+B-K \end{bmatrix} } }[/math]. Prima 15:56, 21 March 2011 (UTC)
Actually, this analysis was based off the basic model. You're right in that in the refined model, the matrix A would change with the relation between M and W. However, I think you swapped the two matrices:
  • If M > W, min(M, W) = W, then the system becomes [math]\displaystyle{ \begin{cases} \Delta M = C - (D + B) \times W \\ \Delta W = (F+B-K) \times W \end{cases} }[/math], hence the matrix A should be [math]\displaystyle{ A = \begin{bmatrix} 0 & -(D+B) \\ 0 & F+B-K \end{bmatrix} }[/math]
  • If M < W, then min(M, W) = W and the system becomes [math]\displaystyle{ \begin{cases} \Delta M = C - (D + B) \times M \\ \Delta W = F \times W +(B-K) \times M \end{cases} }[/math], hence the matrix should be [math]\displaystyle{ A = \begin{bmatrix} -(D+B) & 0 \\ B-K & F \end{bmatrix} }[/math]
The stability analysis for that one is gonna be pretty long, since det A is zero in the first case but not in the second ...
--Homerun-chan 16:20, 21 March 2011 (UTC)
This stability in the first A matrix is associated with the observation by our japanese collegies in regards to F+B-K. Only when F+B-K is negative do we stay with the first 'A' matrix for the whole period, and the stable state corresponds with W=0 and M depends only on Matrix B. Prima 18:18, 21 March 2011 (UTC)

Unrelated

On a totally unrelated note, >mfw more than 350 tweets about this page in the past hour, and 20-50 more every minute...

Matrix calculus is not my strong point, so I will need some time to figure out your analysis. In other words, you're right about the tweets: http://mb.tweetbuzz.jp/entry/36044431 . Prima 13:13, 19 March 2011 (UTC)
I'll try and find the references, that'll make things easier. I'm pretty sure there are a lot of inconsistencies in my analysis too; I don't think ignoring Kyubey's contribution would be so easy... --Homerun-chan 13:16, 19 March 2011 (UTC)
Ah, the original tweet came from the a Sony developer, Keijiro Takahashi, whom lead the development of Ape Escape 3. Prima 14:09, 19 March 2011 (UTC)
I see. Too bad we can't put that on our resume ;_; --Homerun-chan 14:28, 19 March 2011 (UTC)
I see in the refined model, you changed the initial state of W(0) to 1. I think we just found our Walpurgis Night.

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)

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?

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

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?

goodhuntstalker
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]\displaystyle{ \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)

Correcting the model, again

Found some interesting result while working on the refined model, M(t) reach maximum at t= [lnC - ln(PD+PB)]/[F+BP-KP] with Mmax approximately equals c* (tmax - 1/(F+BP-KP)). Checked with the simulation and got 306 and 25337, which appears to be correct. Prima 18:10, 19 March 2011 (UTC)

I see. Good to see you're doing well; then you'll be able to find out why the equilibrium in this graph is 8e3 :)
It's a graph of the refined model, when K>F+B and the soul gem dims over time (I know, I just said I wouldn't do it, but whatever ...) --Homerun-chan 18:35, 19 March 2011 (UTC)
Population dynamics with time.png


This graph makes absolutely no sense to me. lul Prima 18:39, 19 March 2011 (UTC)
Any chance you can provide a data dump of this on pastebin or somewhere. I can't image how W(t) managed to grow. Prima 18:49, 19 March 2011 (UTC)
Sure, what data do you want? I can't realistically print the values for the 3000 iterations, so tell me what values you want. In the meantime, here are what seems to be the values M(t) and W(t) converge to: M(3000) = 8090.3177; W(3000) = 189.8691
And here's the script: [1] --Homerun-chan 20:23, 19 March 2011 (UTC)
Also, don't forget that this is the model where soul gems dim over time. So the reason why W(t) could grow is simply that, at first, there were no witches, so no way for MSes to clean their soul gems, so after a while some of them turn into witches. That's all. --Homerun-chan 20:34, 19 March 2011 (UTC)

Magical Girls to Witches over time

While it is not explicitly stated in the show that a Soul Gem gradually dims over time, I believe that it is implied to be the case. In episode six, we see proof of a constantly active link, of limited range, between a Soul Gem and the body it is linked to. I think it is reasonable to accept that this link would be magical in nature, and therefore provide a slight but constant drain on the Soul Gem's power. This would also allow Kyubei to start the cycle without needing to import witches from elsewhere, or use abilities not shown in canon to directly create a Witch. Jorlem 07:11, 20 March 2011 (UTC)

I believe this is a valid modification to the simple model. Perhaps we need to refactor the second portion of the page into Refinements to the simple model and allow these various refinements their own sections. Prima 07:30, 20 March 2011 (UTC)
In that case, I propose we make a third section ("Third Model", "Time-based Model" or something) with this new version of the model and explanations on the hypothesis (basically, whatJorlem said). I'd gladly make it now, but I'm kinda in a hurry. Plus, I think we should first find a rational conclusion on the graph I posted above, before moving it to the main page; posting a graph and saying "I don't understand it lol" isn't very professional --Homerun-chan 12:36, 20 March 2011 (UTC)
Below is how I plan to refactor this page. Thoughts? Prima 14:22, 20 March 2011 (UTC)


See also

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

Reasoning for removing P from the model

(besides that I am lazy) P is a constant factor that multiples only B, K, and D in every proposed model. Since the actual values of B, K, and D are arbitrary and indetermine to begin with, it does not in fact matter whether B, K, and D are modified by P or not for the purpose of analysis. If we define B',K', D' where B*P=B', etc, we achieve a functionally equivalent set of equation.

One caveat from this simplication means that the values used for B, K, and D may not be equivalent across the different proposed models. For the existing matlab simulations, I multiplied in the value of P into values used for B, K, D to avoid confusion. The outcome of the simulation should remain the same. Prima 09:22, 21 March 2011 (UTC)

Actually, I don't really see why you're so eager to remove P from the equations. Of course, "mathematically" speaking, they remains the same. The main advantage of keeping P as an external factor is that it is easier to read: the values for B, D and K can stay the same across the models, and in one glance you can see that "ah yeah in this model only 80% of girls are fighting", which you do not easily see when absorbing P into B, D and K. --Homerun-chan 16:14, 22 March 2011 (UTC)
It's one less variable to deal with, also in some ways simplify attempts to tackle closed form solutions and hand analysis of the refine models (in special case scenarios). Prima 16:45, 22 March 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)

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)