next up previous contents
Next: Interval valuation and the Up: Equations, Gradient and Hessian Previous: Function involving determinants   Contents

Dealing with undefined expressions

Not all expression may be evaluated using interval arithmetic. For example expression involving a denominator whose interval evaluation contain 0 cannot be evaluated. Similarly expressions involving square root of terms whose lower bound is negative are not allowed. This does not mean that such expressions cannot be dealt with ALIAS but that the code must take care of such cases. The procedures MakeF and MakeJ allows the user to deal with such cases. Note also that a package described in section 2.1.5 allows one to to produce automatically the procedures that are described in this section.

The purpose of the control mechanism is to allow the user to calculate the interval evaluation of terms that may cause a problem for the evaluation and if this a case to attribute a default value to the expression that use these terms. This is done directly at the level of the C++ code.

First of all it will be necessary to define some C++ interval that will be used during the auxiliary computation. MakeF will look at the string `ALIAS/user_FINIT` and if it is not of 0 length will write it directly after the beginning of the procedure. Hence writing:

will allow to use the C++ interval U for the auxiliary computation. The procedure MakeJ uses for a similar purpose the variable `ALIAS/user_JINIT`. For the MakeF procedure the user will have to define a Maple procedure ALIAS_F that will be called before the generation of the C++ code of each equations or inequalities involved in the calculation. The syntax of this procedure is:
where fid is the Maple file descriptor in which the C++ code is written and i is the number of the expression that is considered. This procedure allows to include some C++ code right before the evaluation of the expression i.

For example assume that you have a set of inequalities function of the variable x, y that are defined in the list INEQ and that some of these inequalities may have interval denominator. Hence before the evaluation it is necessary to check if the denominator evaluation may include 0, in which case the whole expression has to be evaluated to a large interval including 0 (indeed the algorithm of ALIAS will then consider that this inequality is not satisfied). An ALIAS_F procedure for this case may be written as:

global INEQ:
local j,aux:

# denom of inequality i is numeric: do nothing
	if type(denom(op(1,INEQ[i])),numeric) then RETURN(0): fi:
# denom is not numeric, evaluate the denominator
#in the C++ evaluation procedure the unknown are in the table v_IS
#substitute the mathematical operator by their interval equivalent
#using ALIAS procedure
#write the denominator evaluation in the C++ file
#if the denominator evaluation include 0 return a large interval
#for expression i
#otherwise proceed with the real evaluation
Note that for MakeF the C++ evaluation of the i-th expression is preceded by the label nexti (hence expression has label next2, expression 3 next3 and so on). Hence you may use a goto next3 to skip the evaluation of the second expression.

A similar mechanism is available for the MakeJ procedure. Before writing the code for the evaluation of the derivative of the expression i with respect to the unknown j the procedure ALIAS_J will be called. The syntax of this procedure is

Note that in this case is compulsory to return a large interval if the evaluation cannot be done as the derivative may be used to improve the evaluation using a first order Taylor expansion. Note that the C++ procedure created by MakeJ evaluates the components of the jacobian element by element although it returns an interval matrix V.

next up previous contents
Next: Interval valuation and the Up: Equations, Gradient and Hessian Previous: Function involving determinants   Contents
Jean-Pierre Merlet 2012-12-20