Precalculated tables

One way to speed up simulations is to use precalculated tables for complicated functions. The Tabulate class defines a table of values of the given function at regularly sampled points. The TabulateInterp class defines a table with linear interpolation, which is much more precise. Both work with scalar and vector arguments.

class brian.Tabulate(f, xmin, xmax, n)

An object to tabulate a numerical function.

Sample use:

g=Tabulate(f,0.,1.,1000)
y=g(.5)
v=g([.1,.3])
v=g(array([.1,.3]))

Arguments of g must lie in [xmin,xmax). An IndexError is raised is arguments are above xmax, but not always when they are below xmin (it can give weird results).

class brian.TabulateInterp(f, xmin, xmax, n)

An object to tabulate a numerical function with linear interpolation.

Sample use:

g=TabulateInterp(f,0.,1.,1000)
y=g(.5)
v=g([.1,.3])
v=g(array([.1,.3]))

Arguments of g must lie in [xmin,xmax). An IndexError is raised is arguments are above xmax, but not always when they are below xmin (it can give weird results).