Skip navigation
About Us Contact Us Software Support

Q: How can I perform a double integration of a generic function?

A: You can calculate the Area Under Curve (integral) for any model or generic function in a SAAM II Compartmental model by setting the Compute Sample AUC’s option in Computational Settings (see How can I calculate the Area Under the Curve for a generic function?). An alternate method can also be used to calculate an AUC that takes advantage of specific characteristics of the compartmental model itself.  By combining the two methods, it’s easy to perform a double integration.

This alternate method for computing an AUC uses a compartment and an input as shown in Figure 1. Throughout an experiment, the compartment will accumulate the total amount of material from the input. If the input is a constant infusion of 2.0 throughout an experiment of duration 100.0, for example, the amount of material in the compartment at any time will be 2.0 * t. At the end of the experiment, the total will be 2.0 * 100.0 = 200.0, the AUC of the input function.

sample image data screen

Figure 1

To perform a double integration, simply set a sample equal to the contents of q1.  For example, follow these steps:

  1. Start the Compartmental application.
  2. Click Experiment Attributes… on the Set menu. In the Experiment Attributes window, enter 100.0 for the End At value.  Click the Done button to close the window.
  3. Draw a single compartment by clicking on the Compartment tool in the Toolbox; then click anywhere in the main model (white) window.
  4. An experiment is needed in order to use the computational machinery in Compartmental.  Click the Experiment button in the Toolbox.  Use the default values in Create Experiment and click the Create button.
  5. To add the input, click on the Input tool in the Toolbox, click on the compartment, q1, and then click on the model window background (since inputs may be attached to multiple compartments, the background click indicates that you are done selecting compartments for this input).
  6. To add the Sample, click on the Sample tool in the Toolbox, click on the compartment, q1, and then click on the model window background. Your model should now appear as shown in Figure 1.
  7. Open the Exogenous Input window by double-clicking on the input object, ex1 (the syringe). For Input Type, click the Equation radio button. Set up the time for the input by entering 0 for Event Start and 100.0 for Event Stop (the end of the experiment). Click in the Equation entry area and enter the exponential equation ex1 = 5000.0 * exp(-0.04 * t). Click the Add button on the right to add this equation to the input list in the top pane of the window. Click the Done button.
  8. Click Settings on the Compute menu to open the Computational Settings box. To activate the Area Under Curve (AUC) functionality, click Compute Sample AUC’s. Click the Done button
  9. The model construction is now complete. By default, the Sample s1 is set equal to the contents of compartment q1.  To check, open the Sample Attributes box by double-clicking the sample object s1, and then close it when done.
  10. Solve the model by clicking Solve on the Compute menu, or by the clicking the Solve toolbar button (looks like a horizontal red slider).
  11. To view the original exponential function, click on the input object, ex1 (it should become highlighted in yellow), and then click on Quick Plot on the View menu.  To see the AUC (integral) of the exponential function, click on the compartment q1 to highlight it, and then click on Quick Plot on the View menu again. To bring the first Quickplot back to the front, click on Quickplot – ex1 on the Window menu. You should see plots that look like Figures 2 and 3.
  12. To view the AUC of the first integral, open the Area Under Curve window by clicking AUC’s on the Show menu. The window should show the AUC of the s1 curve equal to 9.4322e+006.
  13. When done, close each of the three windows and exit the Compartmental Application.

<< Back to Support Page