Displaying 2 results from an estimated 2 matches for "massbalance".
2004 Jun 10
0
lsoda with arbitrary zero thresholds (with psuedo-solution)
...- -y[1] ### These if, else statements are new
> else yd1 <- -p["k1"] * y[1] + p["k2"] * y[2]*y[3]
> if(y[3] < .4) yd3 <- -y[3] ### These if,else statements are new
> else yd3 <- p["k3"] * y[2]^2
> list(c(yd1,-yd1-yd3,yd3),c(massbalance=sum(y)))
> }
> out <- lsoda(c(.5,0,.5),times,lsexamp, parms, rtol=1e-4, atol=
my.atol,
> hmax=.1)
> matplot(out[,1],out[,2:5], type="l")
> out[dim(out)[1],] # The intent of my could was to cause population 1
to
> fall to zero as soon as it reached < 0.4. However...
2001 May 11
1
lsoda
...n value of the function of the system of ode's has to be a list
that includes first, the ode's and second, "a vector
(possibly with a `names' attribute) of global values that are
required at each point in `times'."
I didn't understand from the example why the massbalance = sum(y) was needed
for that system of equations. Why is it needed?
For my function below ('lvcomp2'), I don't know what global values lsoda
needs at each point in time (see???), other than the previous time step's
values of y and the parms. Any help?
Also, any rule of thumb advic...