Start by setting a few parameters; this is the base set of parameters we’ll use.

First, compute the space that any strategy can exist along the “lma” axis:

##          lower    upper
## lma 0.02533822 4.989169

Generate a set of trait values across this range and compute the fitness landscape:

Any trait value along this point can persist, so start with random sample (Set seed for random number generator so that get same results when rerun)

This function takes an lma value, introduces it to the community, runs that out to equilibrium seed rain:

If run interactively it will produce a lot of output

Then compute fitness landscapes for each of these:

For this system, there is an evolutionary attractor around lma 0.0825:

Zooming in in the vicinity of the result shows that this is disruptive selection: fitness increases to both sides of the resident!

Holding the first species at 0.0825 we can introduce additional species (it’s close enough to the optimum here, though in general this point might move substantially as new species are introduced).

Consider introducing a new species at the point of maximum fitness:

## [1] 0.3748389

After introducing this species, the fitness landscape is drawn down around the second species, with a fitness gradient that points towards increased lma.

At the cost of extremely tedious copy/paste code, here is the result of repeatedly taking the lma value with highest fitness and moving the second species to this point, running to equilibrium, and plotting. For comparison the previous landscapes are retained as dotted lines.