Box Precision - Maple Help

Controlling Precision of Box Calculations

Description

 • Calculations with RealBox and ComplexBox objects are controlled by a value called the precision.
 • The current default value for the working precision is determined from the value of the environment variable Digits as
 > 1 + ilog2( 10^Digits );
 ${34}$ (1)

Local Precision Control

 • Most non-operator methods for RealBox and ComplexBox objects accept an option of the form precision = n, where n is a positive integers.
 • This sets the precision to be used in the call to that method while not affecting other computations.
 • Notice that the radius of the resulting box is smaller with a higher precision.
 > sin( RealBox( 0.5 ) );
 ${\mathrm{RealBox}}{}\left({0.4794255385932047}{,}{2.9558578241301037}{}{{10}}^{{-11}}\right)$ (2)
 > sin( RealBox( 0.5 ), 'precision' = 100 );
 ${\mathrm{RealBox}}{}\left({0.47942553860420300027328793521527288278}{,}{4.0059347}{}{{10}}^{{-31}}\right)$ (3)
 > plots:-display( Array( [ plot( x -> Radius(sin(RealBox(x), precision = 30)),  -2*Pi .. 2*Pi),                         plot( x -> Radius(sin(RealBox(x), precision = 40)),  -2*Pi .. 2*Pi) ] ) );

Global Precision Control

 • You can control the precision used by box object methods by setting the value of the environment variable _EnvBoxPrecision to a positive integer.
 • For more information on the use of environment variables, see envvar.
 • For calculations with arithmetic operators, this is the only way to control the precision used in calculations involving both real and complex boxes.
 > p := 7*x^5-22*x^4+55*x^3+94*x^2-87*x+56;
 ${p}{≔}{7}{}{{x}}^{{5}}{-}{22}{}{{x}}^{{4}}{+}{55}{}{{x}}^{{3}}{+}{94}{}{{x}}^{{2}}{-}{87}{}{x}{+}{56}$ (4)
 > eval( p, x = RealBox( 2.3 ) );
 ${\mathrm{RealBox}}{}\left({857.2388099431992}{,}{0.0000013093264001895477}\right)$ (5)
 > _EnvBoxPrecision := 100:
 > eval( p, x = RealBox( 2.3 ) );
 ${\mathrm{RealBox}}{}\left({857.23880999999999999999999999763038}{,}{1.664660}{}{{10}}^{{-26}}\right)$ (6)
 > _EnvBoxPrecision := '_EnvBoxPrecision':
 > eval( p, x = RealBox( 2.3 ) );
 ${\mathrm{RealBox}}{}\left({857.2388099431992}{,}{0.0000013093264001895477}\right)$ (7)
 • Setting the _EnvBoxPrecision variable does not affect the value of Digits. However, changing the value of Digits causes the precision used to be reflected accordingly, although the value of _EnvBoxPrecision itself is not modified.
 > Digits := 100:
 > eval( p, x = RealBox( 2.3 ) );
 ${\mathrm{RealBox}}{}\left({857.2388099999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997825080}{,}{1.3440422}{}{{10}}^{{-96}}\right)$ (8)