I want to define an integral function which depends on a system of ODE and is also used to NDSolve the ODEs.
Tc = Sum[c[i]];
D[c[i], t] == r[i] c[i] (1 - Tc/k) - d[i] c[i]
where i = 1,...,n
Basically, I want to evaluate Tc at a given t value, before solving the differential equation for c[i] so that the code uses this value for NDSolve.
r, k and d are known parameters. c[i] needs to be calculated and thus Tc which is a summation of all c[i]s, at a give time t, is also unknown.
Thanks in advance :)
c[i] == c[i][t]
andTc == Tc[t]
depend on ont
? Looks a bit like the replicator equation. Just enter the equations as you normally would forNDSolve
-- doesn't that work? Or defineTc[t_] = Sum[c[i][t], {i, n}]
outsideNDSolve
and useTc[t]
insideNDSolve
. $\endgroup$