|
Calling Sequence
|
|
RealBox( c, r )
RealBox( b )
Center( b )
Center( b, opt )
Radius( b )
Radius( b, opt )
|
|
Parameters
|
|
c
|
-
|
numeric; the center of the box
|
r
|
-
|
(optional) nonnegative number; the radius of the box
|
b
|
-
|
RealBox object
|
opt
|
-
|
(optional) equation; either form = float or form = rational
|
precopt
|
-
|
(optional) equation of the form precision = n, where n is a positive integer
|
|
|
|
|
Description
|
|
•
|
A RealBox object is defined by two numeric quantities, a center and a non-negative radius .
|
•
|
You can access the center of a RealBox b by using the Center( b ) method, and the radius is available by using the Radius( b ) method.
|
•
|
The method Centre is provided as an alias.
|
•
|
Internally, RealBox objects represent the (finite) centre and radius as binary fractions (that is, with powers of 2 as their denominators). You can access the exact centre and radius by supplying the option form = rational.
|
•
|
If the radius is finite, then a RealBox represents a closed and bounded interval of the real line, namely . In particular, a RealBox with radius equal to represents the single point .
|
•
|
If the radius is infinite, the corresponding RealBox represents the entire real line.
|
•
|
RealBox objects can be combined using arithmetic operations, and have methods that allow you to apply many mathematical functions to them. These operations are effected using a version of interval arithmetic, adapted to boxes.
|
•
|
Arithmetic and mathematical functions applied to a real box also produce a real box as output. The result of an operation is guaranteed to contain the true value of the result of applying the function or arithmetic operation to any value of the input box or boxes. Thus, if is an implemented function, then is a box of the form , where and are such that, for any value in the box , the value lies in the box .
|
|
|
Precision
|
|
•
|
Operations such as arithmetic and the implemented elementary and special functions are controlled by a quantity called the precision. This is a positive integer value that you can set by assigning a value to the environment variable _EnvBoxPrecision.
|
•
|
Many methods for RealBox objects also accept an option of the form precision = n, for a positive integer n, which allows you to exert local control over precision.
|
|
|
Creating Real Boxes
|
|
•
|
The simplest way to create a RealBox object is to pass the RealBox constructor a real constant.
|
•
|
To create a real box with a numeric value c as its center, and with radius equal to , just pass the value c to the RealBox object.
|
•
|
This uses the default value of as the radius, which means that the box object represents the value of its center exactly.
|
•
|
To specify a nonzero radius, the radius argument r can be passed as a second, optional argument.
|
>
|
b := RealBox( 0.5, 1e-5 );
|
| (4) |
| (6) |
•
|
However, the actual radius of a RealBox object depends upon not only the value passed, but also the precision used for construction, as not all values can be exactly represented in floating point.
|
•
|
The rational number can be represented exactly as a float.
|
•
|
Thus, the radius of the resulting box is, in fact, the default value of .
|
•
|
On the other hand, the number is not exactly representable, so the radius of a RealBox representation is nonzero.
|
| (9) |
•
|
The resulting radius is sufficient to ensure that the exact value is contained within the resulting box.
|
| (10) |
>
|
evalb( Center( b2 ) - Radius( b2 ) <= 2/3 );
|
>
|
evalb( 2/3 <= Center( b2 ) + Radius( b2 ) );
|
•
|
Increasing the precision results in a box with smaller radius.
|
>
|
b3 := RealBox( 2/3, precision = 100 );
|
| (13) |
•
|
We can find the exact rational numbers representing the interval using the option form = rational.
|
>
|
cb3 := Center(b3, form = rational);
|
| (14) |
>
|
rb3 := Radius(b3, form = rational);
|
| (16) |
|
|
Special Constants
|
|
•
|
There are several special values and constants implemented that can be passed as an argument to the RealBox object constructor. For some of these, such as infinities, it is not meaningful to specify a nonzero radius. For special constants, the implemented algorithms by default return a RealBox object with a radius determined by the precision.
|
| (19) |
| (20) |
>
|
RealBox( Pi, 'precision' = 1000 );
|
| (21) |
| (22) |
>
|
RealBox( ln( sqrt( 2*Pi ) ) );
|
| (23) |
>
|
RealBox( log( 2 ), 'precision' = 100 );
|
| (24) |
| (25) |
| (26) |
| (27) |
| (28) |
| (29) |
•
|
Note the following raises an exception.
|
>
|
RealBox( infinity, 0.0001 );
|
|
|
Predicates
|
|
•
|
A number of predicates are implemented for RealBox objects. Typically, a predicate returns true if the result is certainly true for all real numbers in the box. If a predicate returns the value false, then the result may or may not be true for all values lying within the box. Thus, to determine whether a predicate is certainly false, you must also test whether the negated predicate is true.
|
|
Predicates
|
|
`<=`
|
compare two RealBox objects for inequality
|
`<`
|
compare two RealBox objects for strict inequality
|
Contains
|
test whether a RealBox object is contained in another
|
Eq
|
test whether two RealBox objects are mathematically equal
|
Equal
|
test whether two RealBox objects are equal as objects
|
HasInteger
|
test whether a RealBox contains an integer
|
HasNegative
|
test whether a RealBox contains a negative value
|
HasNonNegative
|
test whether a RealBox contains a non-negative value
|
HasNonPositive
|
test whether a RealBox contains a non-positive value
|
HasPositive
|
test whether a RealBox contains a positive value
|
HasZero
|
test whether a RealBox contains zero
|
IsExact
|
test whether a RealBox is exact
|
IsFinite
|
test whether a RealBox is finite
|
IsInfinity
|
test whether a RealBox represents infinity
|
IsInteger
|
test whether a RealBox is an integer
|
IsNegative
|
test whether a RealBox is negative
|
IsNegInfinity
|
test whether a RealBox represents negative infinity
|
IsNonNegative
|
test whether a RealBox is non-negative
|
IsNonPositive
|
test whether a RealBox is non-positive
|
IsNonzero
|
test whether a RealBox is nonzero
|
IsOne
|
test whether a RealBox is one
|
IsPositive
|
test whether a RealBox is positive
|
IsUndefined
|
test whether a RealBox represents an undefined value
|
IsZero
|
test whether a RealBox is zero
|
LessEqual
|
compare two RealBox objects for inequality
|
LessThan
|
compare two RealBox objects for strict inequality
|
NotEq
|
test whether two RealBox objects are not equal
|
Overlaps
|
test whether two RealBox objects have a nonempty nntersection
|
|
|
|
|
|
Elementary Functions
|
|
•
|
Many of the elementary functions are implemented as RealBox methods. A list of the available functions appears below.
|
|
Elementary
|
|
abs
|
calculate the absolute value of a RealBox object
|
ceil
|
calculate the ceiling of a RealBox object
|
exp
|
calculate the exponential of a RealBox object
|
expinvexp
|
calculate the exponential and reciprocal exponential of a RealBox object
|
expm1
|
calculate the exponential minus one of a RealBox object
|
floor
|
calculate the floor of a RealBox object
|
hypot
|
calculate the hypotenuse of a pair of real boxes
|
log
|
calculate the logarithm of a RealBox object
|
log1p
|
calculate the logarithm of one plus a RealBox object
|
rsqrt
|
calculate the reciprocal square root of a RealBox object
|
signum
|
calculate the sign of a RealBox object
|
sqrt
|
calculate the square root of a RealBox object
|
sqrtpos
|
calculate the positive square root of a RealBox object
|
|
|
|
|
|
Circular and Hyperbolic Functions
|
|
•
|
The following circular and hyperbolic functions are available as methods for RealBox objects.
|
|
Circular
|
|
arccos
|
compute arccos of a RealBox
|
arccot
|
compute arccot of a RealBox
|
arccsc
|
compute arccsc of a RealBox
|
arcsec
|
compute arcsec of a RealBox
|
arcsin
|
compute arcsin of a RealBox
|
arctan
|
compute arctan of a RealBox
|
cos
|
compute cos of a RealBox
|
cospi
|
compute cospi of a RealBox
|
cot
|
compute cot of a RealBox
|
cotpi
|
compute cotpi of a RealBox
|
csc
|
compute csc of a RealBox
|
sec
|
compute sec of a RealBox
|
sin
|
compute sin of a RealBox
|
sinc
|
compute sinc of a RealBox
|
sincpi
|
compute sincpi of a RealBox
|
sinpi
|
compute sinpi of a RealBox
|
tan
|
compute tan of a RealBox
|
tanpi
|
compute tanpi of a RealBox
|
|
|
|
|
Hyperbolic
|
|
arccosh
|
compute the inverse hyperbolic cosine of a RealBox object
|
arccoth
|
compute the inverse hyperbolic cotangent of a RealBox object
|
arccsch
|
compute the inverse hyperbolic cosecant of a RealBox object
|
arcsech
|
compute the inverse hyperbolic secant of a RealBox object
|
arcsinh
|
compute the inverse hyperbolic sine of a RealBox object
|
arctanh
|
compute the inverse hyperbolic tangent of a RealBox object
|
cosh
|
compute the hyperbolic cosine of a RealBox object
|
coth
|
compute the hyperbolic cotangent of a RealBox object
|
csch
|
compute the hyperbolic cosecant of a RealBox object
|
sech
|
compute the hyperbolic secant of a RealBox object
|
sinh
|
compute the hyperbolic sine of a RealBox object
|
sinhcosh
|
compute the hyperbolic sine and hyperbolic cosine of a RealBox object
|
tanh
|
compute the hyperbolic tangent of a RealBox object
|
|
|
|
|
|
Special Functions
|
|
•
|
Many special and hypergeometric functions have been provided as RealBox object methods, as listed below.
|
|
Special
|
|
AiryAi
|
compute the Airy Ai wave function of a RalBox
|
AiryBi
|
compute the Airy Bi wave function of a RealBox
|
BesselI
|
compute the Bessel I function of a RealBox
|
BesselJ
|
compute the Bessel J function of a RealBox
|
BesselK
|
compute the Bessel K function of a RealBox
|
BesselY
|
compute the Bessel Y function of a RealBox
|
ChebyshevT
|
Chebyshev T function of a RealBox
|
ChebyshevU
|
Chebyshev U function of a RealBox
|
Chi
|
compute the hyperbolic cosine integral of a RealBox
|
Ci
|
compute the cosine integral of a RealBox
|
CoulombF
|
Coulomb's F function of a RealBox
|
CoulombG
|
Coulomb's G function of a RealBox
|
dilog
|
compute the dilogarithm function of a RealBox
|
Ei
|
compute the exponential intergral of a RealBox
|
erf
|
compute the error function of a RealBox
|
erfc
|
compute the complementary error function of a RealBox
|
erfi
|
compute the imaginary error function of a RealBox
|
GAMMA
|
compute the GAMMA function of a RealBox
|
GegenbauerC
|
Gegenbauer C function of a RealBox
|
HermiteH
|
Hermite H function of a RealBox
|
hypergeom
|
general hypergeometric function of a RelaBox
|
JacobiP
|
Jacobi U function of a RealBox
|
KummerM
|
Kummer M function of a RealBox
|
KummerU
|
Kummer U function of a RealBox
|
LaguerreL
|
Laguerre L function of a RealBox
|
LambertW
|
compute the Lambert W function of a RealBox
|
LegendreP
|
Legendre P function of a RealBox
|
lnGAMMA
|
compute the log-GAMMA function of a RealBox
|
Psi
|
compute the Digamma function of a RealBox
|
rGAMMA
|
compute the reciprocal GAMMA function of a RealBox
|
Shi
|
compute the hyperbolic sine integral of a RealBox
|
Si
|
compute the sine integral of a RealBox
|
Zeta
|
compute the Riemann Zeta function of a RealBox
|
|
|
|
|
|
Compatibility
|
|
•
|
The RealBox command was introduced in Maple 2022.
|
|
|
|