Interval evaluation of an expression in

Maple provides the package `evalr` that
calculate the interval evaluation of an expression. An example follows:

readlib(evalr): X:=INTERVAL(0..1): evalr(sin(X)*cos(X)+X);But this package does not evaluate correctly some expressions (for example X-X will be evaluated to 0 whatever is the interval for X). ALIAS-Maple provides the procedure

Interval([x*cos(y)+sin(x*y),x^2-cosh(y)],[x,y],[[-2,2],[-2,2]]); [[[-3, 3]], [[-7.3890560989307,3.8646647167634]]]The first argument is a list of expression, the second argument is the name of the variables and the third a list of intervals for the variables. The procedure generates a C++ program and hence may take some seconds. But as soon as the executable has been created it is possible to re-use it with other intervals using the

Restart("Interval",[[-0.5,0.5],[-0.5,0.5]]);Note however that as soon as you have defined the

An optional 4th argument allows to control the evaluation. Indeed by
default the expression will be transformed into a compact form (as
provided by the procedure `MinimalCout`) that may lead to a better
evaluation. The fourth argument may be:

`"AsIt"`: the expressions are not transformed and are evaluated as they are provided`"Gradient"`: the derivatives of the expressions are used to try to improve the evaluation

Interval([x*sin(x)+cos(x)],[x],[[0,1]]); [[[.54030230586814, 1.8414709848079]]] Interval([x*sin(x)+cos(x)],[x],[[0,1]],"Gradient"); [[[1, 1.381773290676]]]in which the use of the "Gradient" option allows to get the exact interval evaluation. It must be reminded that the interval evaluation of an expression is very sensitive to the manner with which the expression is written. For example the expression for in the interval [-1,1] is evaluated as:

Interval([x^2+2*x+1],[x],[[-1,1]],"AsIt"); [[[-1, 4]]]If the option

Interval([x^2+2*x+1],[x],[[-1,1]]); [[[-2, 4]]]Here it may be noticed that the Horner form leads to a worst interval evaluation. But we may factor this expression as :

Interval([(x+1)^2],[x],[[-1,1]],"AsIt"); [[[0, 4]]]