As I mentioned earlier,
I have been allowed some time to play with Mathematica at
work. I
tried to assess it by transliteration of some of those popPK
spreadsheets and in doing so it has grown on me. I do like
the ability
of the random number generator to produce real numbers over
a specified range. For Excel I had been forced to use
`RANDBETWEEN()` (which only generates integers) and
scale by a large number - this led to many off-by-epsilon
rounding errors. Now I can precalculate the log-normal
probabilities of each of the target limits of the PK
parameters with;`CDF[LogNormalDistribution[mean,
cv/100*mean], Exp[value]]`

and then generate a table
of random parameter values for the population
with;`myList =
Table[Log[Quantile[LogNormalDistribution[myMedian,
myCV/100*myMedian], Random[Real, {myMinProb, myMaxProb}]]],
{populationSize}];`

This seems to be a small price to
pay for having to use studlyCaps for variable names and for
forever forgetting to use square brackets instead of
parentheses and double square brackets instead of
singles. The other major gotcha was not realising that you
have to initialise an array (e.g. by setting to
`Null`) if you
want to subsequently add values to it piecemeal (the error
messages generated are way too arcane).

I also had to change my approach when switching programs as in Mathematica it is actually easier to plot a function defined symbolically than it is to generate a bunch of x,y values and use them.