Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create this coloured graph which I'm going to animate, but I'm stuck with solving a system of three differential equations:

lista = (Sort@{{"Aleppo", 2}, {"Atarib", 2}, {"North Mount Simeon", 2}, 
  {"South Mount Simeon", 2}, {"Al-Safirah", 2}, {"Afrin", 2}, {"Azaz", 2}, 
  {"Al-Bab", 2}, {"Dayr Hafir", 2}, {"Manbij", 2}, {"Ayn Al-Arab", 2}, 
  {"Jarabulus", 2}, {"Daraa", 2}, {"Izra", 2}, {"Al-Sanamayn", 2}, 
  {"Abu Kamal", 2}, {"Mayadin", 2}, {"Deir ez-Zor", 2}, {"Al-Suqaylabiyah", 2}, 
  {"Muhardeh", 2}, {"Masyaf", 2}, {"Hama", 2}, {"Salamiyah",2}, {"Al-Hasakah", 2}, 
  {"Ra's al-'Ayn", 2}, {"Al Qamishli",2}, {"Al-Malikiyah", 2}, {"Homs", 2}, 
  {"Al-Qusayr",2}, {"Talkalakh", 2}, {"Ar-Rastan", 2}, {"Al-Mukharram",2}, 
  {"Palmyra", 2}, {"Harem", 2}, {"Idlib",2}, {"Jisr al-Shugur", 2}, 
  {"Arihah", 2}, {"Ma'arrat al-Numan",2}, {"Latakia", -2}, {"Al-Haffah", -2}, 
  {"Qardaha", -2}, {"Jableh", -2}, {"Quneitra", 2}, {"Fiq", 2}, {"Al-Raqqah", 2}, 
  {"Tell Abyad", 2}, {"Al-Thawrah", 2}, {"Duma",2}, {"Markaz Rif Dimashq", 2}, 
  {"Al-Tall", 2}, {"Al-Qutayfah",2}, {"Al-Nabk", 2}, {"Yabrud", 2}, 
  {"Zabadani", 2}, {"Darayya",2}, {"Qatana", 2}, {"As-Suwayda", 2}, 
  {"Shahba", 2}, {"Salkhad", 2}, {"Tartus", -2}, {"Duraykish", -2}, 
  {"Al-Shaykh Badr", -2},{"Baniyas", -2}, {"Safita", -2}})[[All, 2]];

listb = (Sort@{{"Aleppo", 869}, {"Atarib", 2}, {"North Mount Simeon", 0}, 
  {"South Mount Simeon", 0}, {"Al-Safirah", 0}, {"Afrin",3}, {"Azaz", 26}, 
  {"Al-Bab", 14}, {"Dayr Hafir", 0}, {"Manbij",1}, {"Ayn Al-Arab", 0}, 
  {"Jarabulus", 0}, {"Daraa",31}, {"Izra", 0}, {"Al-Sanamayn", 1}, 
  {"Abu Kamal", 56}, {"Mayadin", 4}, {"Deir ez-Zor", 6}, {"Al-Suqaylabiyah",0}, 
  {"Muhardeh", 0}, {"Masyaf", 0}, {"Hama",565}, {"Salamiyah", 1}, 
  {"Al-Hasakah", 1}, {"Ra's al-'Ayn", 0}, {"Al Qamishli", 36}, {"Al-Malikiyah", 0}, 
  {"Homs",1551}, {"Al-Qusayr", 1}, {"Talkalakh", 1}, {"Ar-Rastan",0}, 
  {"Al-Mukharram", 0}, {"Palmyra", 26}, {"Harem", 0}, {"Idlib", 359}, 
  {"Jisr al-Shugur", 0}, {"Arihah", 0}, {"Ma'arrat al-Numan", 0}, {"Latakia", 224}, 
  {"Al-Haffah", 0}, {"Qardaha", 16}, {"Jableh", 3}, {"Quneitra", 22}, 
  {"Fiq",1}, {"Al-Raqqah", 0}, {"Tell Abyad", 6}, {"Al-Thawrah",0}, 
  {"Duma", 0}, {"Markaz Rif Dimashq", 0}, {"Al-Tall" ,0}, {"Al-Qutayfah", 0}, 
  {"Al-Nabk", 0}, {"Yabrud",4}, {"Zabadani", 49}, {"Darayya", 27}, {"Qatana",8}, 
  {"As-Suwayda", 0}, {"Shahba", 0}, {"Salkhad",0}, {"Tartus", 48}, 
  {"Duraykish", 1}, {"Al-Shaykh Badr", 0}, {"Baniyas", 74}, {"Safita", 1}})[[All, 2]];

listc = (1 - lista);

eq = DSolve[{
  x'[t] == #1*y[t]*z[t] - #2*x[t]*y[t],
  y'[t] == #3*y[t] - #2*x[t]*y[t],
  z'[t] == #1*(x[t] - y[t]),
  x[0] == 219100,
  y[0] == 287500,
  z[0] == 1505920},
  {x, y, z}, t] & @@@ Thread[{lista, listb, listc}]

I'm still receiving errors:

enter image description here

And

enter image description here

EDIT: Okay, so I edited listb so that all the 0s became 1s. But now I get this error:

enter image description here

share|improve this question
    
In listb = ... you have a Null (look after Masyaf). Also, try changing DSolve to foo in the last line and you will see one of your equalities is trivial (i.e. it's evaluating to True) – mfvonh May 21 '14 at 16:46
    
Would that be the z'(t) equation? – user3482534 May 21 '14 at 17:02
    
Yes. It is evaluating to True for some values. – mfvonh May 21 '14 at 17:06
    
How can I fix that? – user3482534 May 21 '14 at 17:08
    
It's an issue with your data: you'll have to comb through it. Essentially you are ending up with something like 1 == 1, which doesn't provide any info to the DiffyQ solver. – mfvonh May 21 '14 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.