Computing the Integral or Derivative of a 1-D Lookup Table

In some cases, you may want to compute the integral or derivative of the function defined by a Lookup Table.

To implement these, you can add a second argument to the table function A special function for referencing user-defined lookup tables that can be referenced in input fields. It is automatically created whenever you create a Lookup Table element.:

Function Behavior
Tablename(Row Variable, TBL_Derivative) Returns the derivative of the function at the specified row value.
Tablename(Row Variable, TBL_Integral) Returns the integral of the table function up to the specified row value.
Tablename(Result Variable, TBL_Inv_Integral) Returns the row value corresponding to a specified integral for the table result (the result variable).

For example, if you had a Lookup Table (named Volume) in which the independent variable was a length and the dependent variable was a volume, then the following expression would return the derivative of the corresponding function (an area) when the independent variable was 5 m:

Note: These arguments can only be used with 1-D tables. They cannot be used by 2-D and 3-D tables.

The best way to illustrate how these functions are calculated is to consider a simple example. Consider the following 1-D Table (named "Volume), in which the independent variable has dimensions An output attribute for an element that defines the dimensionality (in terms of Length, Time and other fundamental dimensions) of the output. of length and the dependent variable has dimensions of volume:

Computing the Derivative

The plot below shows how GoldSim would compute Volume(X, TBL_Derivative) for different values of X:

Several points should be noted:

Computing the Integral

The plot below shows how GoldSim would compute Volume(X, TBL_Integral) for different values of X:

Several points should be noted:

Computing the Inverse Integral

The plot below shows how GoldSim would compute Volume(X, TBL_Inv_Integral) for different values of X:

Several points should be noted:

One practical application of the use of these functions is when creating tables that describe how the surface area, volume and water elevation in a pond or reservoir are related. In these kinds of problems, you often would compute the volume, and then use a table to output the surface area and elevation corresponding to that volume. One way to do this in a consistent way using the table functions would be to define a table (named, say, Area_from_Elevation) that outputs the surface area as a function of the water elevation (i.e., the independent variable would be elevation and the dependent variable would be surface area). Given a volume (V), you could then use this table to compute the elevation and surface area as follows:

Elevation = Area_from_Elevation(V, TBL_Inv_Integral)
Surface_Area = Area_from_Elevation(Elevation)

An example model which illustrates these functions (TableFunctions.gsm) can be found in the General Examples/LookupTable folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).