**$IntegralStop**

The $IntegralStop directive can be used in conjunction with the equation-based Integral function. It can be used in Subprograms or in the main program.

The equation-based Integral function does not employ the Parametric table to specify the values of the integration variable, as does the table-based Integral function. Rather, the lower and upper limits and optionally, the step size of the integration variable is specified as arguments within the Integral function, e.g.,

F = INTEGRAL(*Integrand, VarName, LowerLimit, UpperLimit, StepSize*) {StepSize is optional}

In some situations, the upper limit of the integration variable is not known apriori and it is necessary to stop the integration when a variable other than the integration variable exceeds a specified limit. That is the purpose of the $IntegralStop directive.

The format of the $IntegralStop directive is

$IntegralStop IntegrationVarName Condition /n

where

IntegrationVarName is the name of the independent integration variable in an equation-based Integral function

Condition is an inequality specification of the form: EESVarName<Value where EESVarName is the name of any EES variable in use within the Main program or Subprogram in which the Integral function is used. Value is a numerical value or name of an EES variable that has been set to a value. Condition will accept either < or > operators.

/n is optional. Without this specification, EES will display a dialog indicating when the condition has been met and offer the option of stopping or continuing the integration, as seen in the example. If /n provided, then EES will not display a dialog, but rather, just terminate the integration process.

Notes:

1. The $IntegralStop directive should be placed after the equation involving the Integral function to which it applies. If the Integral function is within a Subprogram, the $IntegralStop directive must also be placed within the Subprogram.

2. The integration process used a discrete step process. The Condition is checked after each integration step. It is not possible to specify a condition of the form EESVarName=Value. The value of the independent integration variable at which the Condition is met will be affected by the step size chosen for the integration.

3. Multiple $IntegralStop directives are allowed.

4. If the $IntegralStop directive terminates the integration process, an error condition will be raised internally, and this will stop all following calculations. When used within a Subprogram, the error condition may prevent the outputs of the Subprogram from being updated. It is best to reset the upper limit of the integral to the value at which the integration was stopped and then resolve the problem.

**Example:**

L=integral(x^2, x, 0, 5)

L2=L+x

$IntegralStop x L2>0.5

The following dialog will appear when solving these equations.

See also: $IntegralTable