Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DomainError for some values of the hill exponent #76

Closed
Azenor opened this issue May 23, 2019 · 1 comment · Fixed by #83
Closed

DomainError for some values of the hill exponent #76

Azenor opened this issue May 23, 2019 · 1 comment · Fixed by #83
Labels

Comments

@Azenor
Copy link
Collaborator

Azenor commented May 23, 2019

When using some values of h different from 1.0 or 2.0, we get a DomainError when executing the function simulate(). It seems to occur with the keywords :species, :system, :competitive but not with :nutrients.

Reproducible example :

A = [0 0 0 0 0; 1 0 1 0 0; 1 0 0 0 0; 0 1 0 0 0; 0 0 0 0 0] ;
p = model_parameters(A, productivity = :system, h = 1.2);
s = simulate(p, rand(p[:S]), stop=1000)

Error obtained :

ERROR: DomainError with -6.825133204115963e-9:
Exponentiation yielding a complex result requires a complex argument.
Replace x^y with (x+0im)^y, Complex(x)^y, or similar.

It seems to come from the matrix structure. When removing one link such that A = [0 0 0 0 0; 1 0 1 0 0; 0 0 0 0 0; 0 1 0 0 0; 0 0 0 0 0], it works.

System information

  • julia --version
  • Pkg.status("BioEnergeticFoodWebs")
  • OS and version
@evadelmas
Copy link
Collaborator

Hi @Azenor
Biomass values can temporary drop below 0 by up to 1e-6 which causes this DomainError when the hill exponent is 1<h<2. Should be fixed now (on the next branch at least, I'm planning on merging to master in the next few days).

evadelmas added a commit that referenced this issue May 28, 2019
@evadelmas evadelmas mentioned this issue Jul 5, 2019
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants