Interval type and basic interval operations
written by Grimmer, Markus, Department of Mathematics, University of Wuppertal, Germany, http://www.math.uni-wuppertal.de/wrswt
<© 1999-2002 Scientific Computing/Software Engineering Research Group, University of Wuppertal, Germany>
NOTE: This worksheet demonstrates the use of the Maple package intpakX v1.0 for interval arithmetic.
This document is not the package. It only shows how to work with the functions and types provided by
intpakX v1.0
. You must create the package in an empty directory before loading the package ( i.e., /usr/maple/intpakX/lib) Once created, load the package as follows:
| > | restart; libname:="C:/mylib/interval", libname; with(intpakX); |
Warning, the name changecoords has been redefined
Warning, the assigned name midpoint now has a global binding
Warning, the protected names ilog10, max and min have been redefined and unprotected
Interval type and basic interval operations
`type/interval`: An interval is defined to be a list with either zero elements,+/- infinity,FAIL
or a list with two floating point members.
You can define an interval in the following ways:
| > | X:=[1.0,2.5]; type(X,interval); |
| > | Y:=[0,infinity]; type(Y,interval); |
| > | Z:=construct(1,2); type(Z,interval); |
Procedures convert/inapply:
Utility procedures to convert Maple expressions to interval arithmetic.
convert(1+x + x^2,'interval') returns (1 &+ x) &+ (x &^ 2),
whereas inapply(1+x+x^2,x) yields the operator x -> (1 &+ x) etc.
| > | convert(1+x + x^2,'interval'); inapply(1+x+x^2,x); |
Procedures is_in, midpoint, width, &intersect, &union
| > | A:=[1.,4.]; B:=[2.,3.]; is_in(B,A); |
| > | midpoint(A); width(A); A &union [5.,6.]; A &intersect [3.,5.]; |
Arithmetic operations &+,&-,&*,&/
In addition to &/, there is the operator ext_int_div which can also handle "division by zero".
| > | A &+ B; A &- B; A &* B; A &/ B; |
| > | C:=[-1.,1.]; A &/ C; ext_int_div(A,C); |
Trigonometric operations:
&sin, &cos, &tan, &arcsin, &arccos, &arctan, &sinh, &cosh, &tanh
| > | &sin(A); # etc. |
Exponential Function and Logarithm:
&exp, &ln
| > | &exp(A); # etc. |
Square, square root and power functions:
&sqr, &sqrt, &intpower, &**
&intpower raises an interval to an integer power, while &** raises an interval to the power of another interval.
Note the difference between C*C and &sqr(C)!
| > | E:=[1.9,2.1]; A &intpower 2; A &** E; |
| > | C&*C; &sqr(C); |
| > |
| > |
Disclaimer: While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material.