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 ) );
 ${⟨}{\text{RealBox:}}{0.479426}{±}{2.95586ⅇ-11}{⟩}$ (2)
 > sin( RealBox( 0.5 ), 'precision' = 100 );
 ${⟨}{\text{RealBox:}}{0.479426}{±}{4.00593ⅇ-31}{⟩}$ (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 ) );
 ${⟨}{\text{RealBox:}}{857.239}{±}{1.30933ⅇ-06}{⟩}$ (5)
 > _EnvBoxPrecision := 100:
 > eval( p, x = RealBox( 2.3 ) );
 ${⟨}{\text{RealBox:}}{857.239}{±}{1.66466ⅇ-26}{⟩}$ (6)
 > _EnvBoxPrecision := '_EnvBoxPrecision':
 > eval( p, x = RealBox( 2.3 ) );
 ${⟨}{\text{RealBox:}}{857.239}{±}{1.30933ⅇ-06}{⟩}$ (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 ) );
 ${⟨}{\text{RealBox:}}{857.239}{±}{1.34404ⅇ-96}{⟩}$ (8)