# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 0.6.3
#     language: julia
#     name: julia-0.6
# ---

# ## Macroparasite model from May and Anderson (1978) in Julia
#
# *Author*: <NAME> @federigia
#
# *Date*: 2018-10-03 

using DifferentialEquations

function macrop_ode(dY,Y,p,t)
 dY[1] = (p[1]-p[2])*Y[1] - p[3]*Y[2]
 dY[2] = p[4]*Y[1]*Y[3] - (p[5]+p[3]+p[2])*Y[2] - (p[3]*((Y[2]^2)/Y[1])*((p[6]+1)/p[6])) 
 dY[3] = p[7]*Y[2] - (p[8]*Y[3]) - (p[4]*Y[1]*Y[3])
end

par=[1.4,1.05,0.0003,0.01,0.5,0.1,10.0,10.0]
init=[100.0,10.0,10.0]
tspan=(0.0,100.0)

macro_par = ODEProblem(macrop_ode,init,tspan,par)

sol=solve(macro_par);

using Plots

plot(sol,xlabel="Time",yscale=:log10)

StarcoderdataJupyterScriptsDedupFiltered