Adaptive: parameter space sampling made easy
Let's set the scene¶
You're a researcher doing numerical modelling. You're an old hand. You use Python (and therefore are awesome).
Your days are spent constructing mathematical models, implementing them in code, and exploring the models as you change different parameters. You realize that simplicity is key, so you make sure to write your models as pure functions of the parameters, maybe a little something like this:
def complicated_model(x, y):
...
return result
Beautiful; now it's time to do some science! Of course, you'll want to plot your model as a function of the parameters. Python makes this super simple but, as we'll see, this simplicity has a price.
You start off the same way you have a million times before: gridding your parameter space and mapping complicated_model
over it:
N = 25
xs = np.linspace(-1, 1, N)
ys = np.linspace(-1, 1, N)
answers = [complicated_model(x, y) for x, y in itertools.product(xs, ys)]