Wednesday, October 26, 2011

Section 2.15.5.1 in Roff (2010): "Brute force using many values"

On page 134 of Roff (2010) you are instructed to re-use a previous function from 2.15.3, swapping out "G" and "Alpha" for "X". This is fairly straight forward, but I messed it up my first try.

The original code is (2.15.3, page 132) is

FITNESS <- function(x)
{
G <- x[1]
Alpha<- x[2]
...
}



For section 2.15.5.1, this needs to be changes to

FITNESS <- function(G, Alpha) #
{
G <- G #
Alpha<- Alpha)
...
}

The upshot:
1)change it so that G and Alpha get called instead of x
2)AND be sure to assign G and Alpha to, well, G and alpha (which get defined lower in the code in Program" section of 2.15.5.1

No comments:

Post a Comment