You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for developing and maintaining the package!
I run into the following error when trying to plot a phase diagram on a 2-dim system. The function is:
## Pollution model:
pollution <- function(t, y, params){
with(as.list(c(y, params)), {
x = numeric(length = n)
x = y
pollutant <- u - s*x + v * (x^alpha/(z^alpha + x^alpha))
outflow <- (A_ij * delta_ij) %*% x
inflow <- t(A_ij * delta_ij) %*% x
dx <- pollutant + (inflow - outflow)
return(list(c(dx)))
})
}
With the following parameters:
n <- 1 # number of systems
delta_ij <- matrix(runif(n^2, min = 0.02, max = 0.05), ncol = n)
A_ij <- matrix(rbinom(n^2, 1, prob = 0.3), n, n)
## Parameters:
params <- list(
n = n, # number of systems (e.g. lakes)
u = rep(0.5, n), # pollution load from humans
s = rep(2.5, n), # internal loss rate (sedimentation)
v = rep(10, n), # max level of internal nutrient release
z = rep(2.2, n), # threshold
alpha = 4 , # sharpness of the shift
delta_ij = delta_ij, # matrix of difussion terms
A_ij = A_ij # adjacency matrix
)
Error in (A_ij * delta_ij) %*% x : non-conformable arguments
I don't quite understand the origin of the error. The system works with n = 1, 2, or 100s when doing numerical simulations with deSolve, but for some reason fails on the two-dimensional case in phaseR.
If I rewrite the function in a non-matrix form such as:
Thanks for developing and maintaining the package!
I run into the following error when trying to plot a phase diagram on a 2-dim system. The function is:
With the following parameters:
phaseR
works on the one-dimensional case, eg:But as soon as I change
n = 2
I get the following error:fld <- flowField(pollution, xlim = c(0,5), ylim = c(-2,7), system = "two.dim", add = FALSE, parameters = params)
I don't quite understand the origin of the error. The system works with n = 1, 2, or 100s when doing numerical simulations with
deSolve
, but for some reason fails on the two-dimensional case inphaseR
.If I rewrite the function in a non-matrix form such as:
Trying to get the flow field throughs a different error:
fld <- flowField(pollution2, xlim = c(0,5), ylim = c(-2,7), system = "two.dim", add = FALSE, parameters = params)
Which seems similar to issue #13
Any help is greatly appreciated!
Below my session info if useful:
The text was updated successfully, but these errors were encountered: