User Tools

Site Tools


2016:groups:g1:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
2016:groups:g1:start [2016/01/03 18:39] – [Suggested questions] mendes2016:groups:g1:start [2024/01/09 18:45] (current) – external edit 127.0.0.1
Line 2: Line 2:
 ====== Less is more: when positives don't sum ====== ====== Less is more: when positives don't sum ======
  
 +==== Plot 1 ====
 +
 +%matplotlib inline
 +from numpy import *
 +from matplotlib.pyplot import *
 +from scipy.integrate import odeint
 +ion()
 +
 +t = arange(0,2., 0.01)
 +
 +# parameters
 +fr = 8.75
 +fa = 6.25
 +p = 0.7
 +c = 0.01
 +g = 0.001
 +
 +# initial condition: this is an array now!
 +x0 = array([10., 10.]) # Pr, Pa
 +
 +# the function still receives only `x`, but it will be an array, not a number
 +def LV(x, t, fr, fa, p, c, g):
 +    # in python, arrays are numbered from 0, so the first element 
 +    # is x[0], the second is x[1]. The square brackets `[ ]` define a
 +    # list, that is converted to an array using the function `array()`.
 +    # Notice that the first entry corresponds to dV/dt and the second to dP/dt
 +    return array([ (fr*p*x[0]) + fa*p*x[1] - ((c-g)*x[0]*(x[0]+x[1])),
 +                   (fa*(1-p)*x[1]) + fr*(1-p)*x[0] - ((c-3*g)*x[1]*(x[0]+x[1])) ])
 +
 +# call the function that performs the integration
 +# the order of the arguments is as below: the derivative function,
 +# the initial condition, the points where we want the solution, and
 +# a list of parameters
 +x = odeint(LV, x0, t, (fr, fa, p, c, g))
 +
 +# plot the solution
 +plot(t, x)
 +xlabel('$t [years^{-1}]$', fontsize=25) # define label of x-axis
 +ylabel('$Plants Population$', fontsize=25) # and of y-axis
 +legend(['$P_{r}$', '$P_{a}$'], loc='lower right', fontsize=20)
 +savefig('foo1.pdf')
 +==== Portuguesa ====
 +t = arange(0,3., 0.01)
 +rFec = t = arange(0,10.,1)
 +rGam = arange(0,100.,10)
 +
 +for i in range(len(rFec)):
 +    for j in range(len(rGam)):
 +        x = odeint(LV, x0, t, (fr, fa, p, c, g, i, j))
 +        A[i,j] = x[5,1]/(x[5,1] + x[5,0]) 
  
 Wiki site of the practical exercise of the [[http://www.ictp-saifr.org/mathbio5|V Southern-Summer School on Mathematical Biology]]. Wiki site of the practical exercise of the [[http://www.ictp-saifr.org/mathbio5|V Southern-Summer School on Mathematical Biology]].
Line 11: Line 61:
 ==== Introduction ==== ==== Introduction ====
  
-Mutualisms are ubiquitous in nature and mutualistic interactions are expected to increase the fitness of interacting species. However, species engage in multiple interactions at the same time. For instance, many plants engage in multiple mutualistic interactions with a diverse range of organisms. Pollinators assist in plant'reproduction, frugivores disperse their seeds and microorganisms provide them nutrients ((for example, [[https://en.wikipedia.org/wiki/Rhizobia|Rhyzobia]] bacteria in root nodules provide nitrogen to plants)). When multiple mutualistic interactions occur at the same time, it is important to understand the contribution of each interaction on species' fitness. The interplay between different interactions can be difficult to predict and might have synergistic effects. +Mutualisms are ubiquitous in nature and mutualistic interactions are expected to increase the fitness of interacting species. However, species engage in multiple interactions at the same time. For instance, many plants engage in multiple mutualistic interactions with a diverse range of organisms. Pollinators assist in plant reproduction, frugivores disperse their seeds and microorganisms provide them nutrients ((for example, [[https://en.wikipedia.org/wiki/Rhizobia|Rhyzobia]] bacteria in root nodules provide nitrogen to plants)). When multiple mutualistic interactions occur at the same time, it is important to understand the contribution of each interaction on species' fitness. The interplay between different interactions can be difficult to predict and might have synergistic effects. 
  
 A recent paper by Godschalx and colleagues (2015) found that nitrogen-fixing bacteria can influence mutualistic interactions that lima bean plants (//Phaseolus lunatus//) engage with protective ants. The authors show that the effects of different mutualistic interactions cannot be described by considering simply their individual effect. A recent paper by Godschalx and colleagues (2015) found that nitrogen-fixing bacteria can influence mutualistic interactions that lima bean plants (//Phaseolus lunatus//) engage with protective ants. The authors show that the effects of different mutualistic interactions cannot be described by considering simply their individual effect.
Line 31: Line 81:
 ===== References ===== ===== References =====
  
-  *Godschalx et al (2015) //Ants are less attracted to the extrafloral nectar of plants with symbiotic, nitrogen-fixing rhizobia// Ecology 96(2), pp.348-354 [[http://www.esajournals.org/doi/abs/10.1890/14-1178.1|link]]+  *Godschalx //et al.// (2015) //Ants are less attracted to the extrafloral nectar of plants with symbiotic, nitrogen-fixing rhizobia// Ecology 96(2), pp.348-354 [[http://www.esajournals.org/doi/abs/10.1890/14-1178.1|link]] 
 + 
 +=====Maria Bonita===== 
 +<code> 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,50., 0.01) 
 + 
 +# parameters 
 +rv = 0.8 
 +rr = 1.5 
 +ra = 0.6 
 +kv = 5. 
 +kr = 5. 
 +ka = 5. 
 +a = 0.15 
 +b = 0.03 
 +c = 0.15 
 +d = 0.02 
 +n = 0.1 
 +p = 1 
 +alfa = 0.25 
 +beta = 0.25 
 + 
 +# initial condition 
 +x0 = array([1., 1., 1.]) # V, R, A 
 + 
 +def LV(x, t, rv, rr, ra, kv, kr, ka, a, b, c, d, p, n, alfa, beta): 
 +    return array([ rv*x[0]*(1-(x[0]/kv)) + a*x[0]*x[1] - p*(1+sin(t))*x[0]/(n+alfa*x[1]+beta*x[2]), 
 +                   rr*x[1]*(1-(x[1]/kr)) + b*x[0]*x[1] - c*x[1]*p*(1+sin(t))*x[0]/(n+alfa*x[1]+beta*x[2]) , 
 +                   ra*x[2]*(1-(x[2]/ka)) + d*x[2]*p*(1+sin(t))*x[0]/(n+alfa*x[1]+beta*x[2])]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (rv, rr, ra, kv, kr, ka, a, b, c, d, p, n, alfa, beta)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['V', 'R', 'A'], loc='lower right'
 +</code> 
 + 
 + 
 + 
 +=====Right First Model===== 
 +<code> 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,3., 0.01) 
 + 
 +# parameters 
 +fr = 8.75 
 +fa = 6.25 
 +c = 0.01 
 +p = 0.5 
 +g = 0.001 
 + 
 +# initial condition 
 +x0 = array([50., 50.]) # Pr, Pa 
 + 
 +def LV(x, t, fr, fa, p, c, g): 
 +    # in python, arrays are numbered from 0, so the first element  
 +    # is x[0], the second is x[1]. The square brackets `[ ]` define a 
 +    # list, that is converted to an array using the function `array()`. 
 +    # Notice that the first entry corresponds to dV/dt and the second to dP/dt 
 +    if t > 25.: 
 +        g = 0. 
 +    p = 0.25 * sin(6*t) + 0.5 
 +    return array([ (fr*p*x[0]) + fa*p*x[1] - ((c-g)*x[0]*(x[0]+x[1])), 
 +                   (fa*(1-p)*x[1]) + fr*(1-p)*x[0] - ((c-3*g)*x[1]*(x[0]+x[1])) ]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (fr, fa, p, c, g)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['Pr', 'Pa'], loc='lower right'
 +</code> 
 + 
 + 
 +=====Killing the Ants at t = 25===== 
 +<code> 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,50., 0.01) 
 + 
 +# parameters 
 +fr = 8.75 
 +fa = 6.25 
 +c = 0.01 
 +p = 0.5 
 +g = 0.001 
 + 
 +# initial condition 
 +x0 = array([50., 50.]) # Pr, Pa 
 + 
 +def LV(x, t, fr, fa, p, c, g): 
 +    # in python, arrays are numbered from 0, so the first element  
 +    # is x[0], the second is x[1]. The square brackets `[ ]` define a 
 +    # list, that is converted to an array using the function `array()`. 
 +    # Notice that the first entry corresponds to dV/dt and the second to dP/dt 
 +    if t > 25.: 
 +        g = 0. 
 +    p = 0.25 * sin(t/5) + 0.5 
 +    return array([ (fr*p*x[0]) + fa*p*x[1] - ((c-g)*x[0]*(x[0]+x[1])), 
 +                   (fa*(1-p)*x[1]) + fr*(1-p)*x[0] - ((c-3*g)*x[1]*(x[0]+x[1])) ]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (fr, fa, p, c, g)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['Pr', 'Pa'], loc='lower right'
 +</code> 
 + 
 +=====El Pato  ===== 
 +<code> 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,3., 0.01) 
 + 
 +# parameters 
 +fr = 8.75 
 +fa = 6.25 
 +p = 0.7 
 +c = 0.01 
 +g = 0.001 
 + 
 +# initial condition: this is an array now! 
 +x0 = array([10., 10.]) # Pr, Pa 
 + 
 +# the function still receives only `x`, but it will be an array, not a number 
 +def LV(x, t, fr, fa, p, c, g): 
 +    # in python, arrays are numbered from 0, so the first element  
 +    # is x[0], the second is x[1]. The square brackets `[ ]` define a 
 +    # list, that is converted to an array using the function `array()`. 
 +    # Notice that the first entry corresponds to dV/dt and the second to dP/dt 
 +    return array([ (fr*p*x[0]) + fa*p*x[1] - ((c-g)*x[0]*(x[0]+x[1])), 
 +                   (fa*(1-p)*x[1]) + fr*(1-p)*x[0] - ((c-3*g)*x[1]*(x[0]+x[1])) ]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (fr, fa, p, c, g)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['Pr', 'Pa'], loc='lower right'
 +</code> 
 +
 +===== Patolihno ===== 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,50., 0.01) 
 + 
 +# parameters 
 +rv = 0.8 
 +rr = 1.5 
 +ra = 0.6 
 +rp = 0.2 
 +kv = 5. 
 +kr = 5. 
 +ka = 5. 
 +kp = 4. 
 +a = 1.5 
 +b = 3. 
 +c = 1.5 
 +d = 2. 
 +e = 2. 
 +n = 0.6 
 +alfa = 2.5 
 +beta = 2.5 
 + 
 +# initial condition 
 +x0 = array([10., 40., 8.,8.]) # V, R, A, P 
 + 
 +def LV(x, t, rv, rr, ra, rp, kv, kr, ka, kp, a, b, c, d, e, n, alfa, beta): 
 +    return array([ rv*x[0]*(1-(x[0]/kv)) + a*x[0]*x[1] - x[3]*x[0]/(n+alfa*x[1]+beta*x[2]), 
 +                   rr*x[1]*(1-(x[1]/kr)) + b*x[0]*x[1] - c*x[1]*x[3]*x[0]/(n+alfa*x[1]+beta*x[2]) , 
 +                   ra*x[2]*(1-(x[2]/ka)) + d*x[2]*x[3]*x[0]/(n+alfa*x[1]+beta*x[2]) 
 +                   rp*x[3]*(1-(x[3]/kp)) - e*x[3]*x[2] + x[3]*x[0]/(n+alfa*x[1]+beta*x[2])]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (rv, rr, ra, rp, kv, kr, ka, kp, a, b, c, d, e, n, alfa, beta)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['V', 'R', 'A', 'P'], loc='upper left'
 + 
 +===== Code ===== 
 +<code> 
 + 
 +%matplotlib inline 
 +from numpy import * 
 +from matplotlib.pyplot import * 
 +from scipy.integrate import odeint 
 +ion() 
 + 
 +t = arange(0,10., 0.01) 
 + 
 +# parameters 
 +fr = 1.5  
 +fa = 2. 
 +p = 0.6 
 +c = 0.2 
 +g = 15. 
 + 
 +# initial condition: this is an array now! 
 +x0 = array([50., 50.]) # Pr, Pa 
 + 
 +# the function still receives only `x`, but it will be an array, not a number 
 +def LV(x, t, fr, fa, p, c, g): 
 +    # in python, arrays are numbered from 0, so the first element  
 +    # is x[0], the second is x[1]. The square brackets `[ ]` define a 
 +    # list, that is converted to an array using the function `array()`. 
 +    # Notice that the first entry corresponds to dV/dt and the second to dP/dt 
 +    return array([ (fr*p*x[0]) + fa*p*x[1] - ((c/g)*x[0]*(x[0]+x[1])), 
 +                   (fa*(1-p)*x[1]) + fr*(1-p)*x[0] - ((c/(3*g))*x[1]*(x[0]+x[1])) ]) 
 + 
 +# call the function that performs the integration 
 +# the order of the arguments is as below: the derivative function, 
 +# the initial condition, the points where we want the solution, and 
 +# a list of parameters 
 +x = odeint(LV, x0, t, (fr, fa, p, c, g)) 
 + 
 +# plot the solution 
 +plot(t, x) 
 +xlabel('t') # define label of x-axis 
 +ylabel('populations') # and of y-axis 
 +legend(['Pr', 'Pa'], loc='lower right'
 + 
 +</code>
2016/groups/g1/start.1451846391.txt.gz · Last modified: 2024/01/09 18:45 (external edit)