Arithmetic - Maple Help

RealBox

 Arithmetic
 arithmetic for RealBox objects
 +
 compute a sum involving RealBox objects
 *
 compute a product involving RealBox objects
 ^
 compute a power involving RealBox objects
 -
 compute the negative of RealBox object
 /
 compute the reciprocal of RealBox object

 Calling Sequence -b 1/b a + b s + b a * b s * b a ^ b a ^ s s ^ b

Parameters

 a - RealBox object b - RealBox object s - numeric; a real constant

Description

 • RealBox objects have been provided with methods implementing the standard arithmetic operators in Maple. This means that you can form arithmetic expressions using real boxes and they will evaluate to RealBox objects representing the result of those operations.
 • Note that addition ($\mathrm{+}$) and multiplication ($\mathrm{*}$) are, in fact, $n$-ary operators that may have one or more operands, while negation ($\mathrm{-}$) and reciprocation ($\mathrm{/}$) are unary. See object/operators for more details on the semantics of operator methods for objects in Maple.
 • These are the arithmetic operators available for RealBox objects.

 -b the negation of b 1/b the reciprocal of b a + b the sum of a and b a * b the product of a and b a / b the quotient of a and b a ^ b the b-th power of a a ^ s the s-th power of a

 • In most cases, these are defined when one argument is a (Maple) real numeric value, provided at least one operand is a RealBox object. (Otherwise, Maple's standard arithmetic applies as box objects are not involved.)
 • For information about using arithmetic operators with ComplexBox operands, see ComplexBox[Arithmetic].

Examples

Negation and reciprocation are unary operators for RealBox objects.

 > $-\mathrm{RealBox}\left(2.3\right)$
 ${⟨}{\text{RealBox:}}{-2.3}{±}{2.32831ⅇ-10}{⟩}$ (1)
 > $\frac{1}{\mathrm{RealBox}\left(2.3\right)}$
 ${⟨}{\text{RealBox:}}{0.434783}{±}{7.31179ⅇ-11}{⟩}$ (2)

Note that unlike Maple floats, the reciprocal of $0$ yields an undefined RealBox, rather than an infinity.

 > $\frac{1}{\mathrm{RealBox}\left(0.0\right)}$
 ${⟨}{\text{RealBox:}}{nan}{±}{0}{⟩}$ (3)
 > $\mathrm{RealBox}\left(2.3\right)+\mathrm{RealBox}\left(-4.7\right)$
 ${⟨}{\text{RealBox:}}{-2.4}{±}{6.98492ⅇ-10}{⟩}$ (4)
 > $\mathrm{RealBox}\left(2.3\right)+55.55$
 ${⟨}{\text{RealBox:}}{57.85}{±}{7.68341ⅇ-09}{⟩}$ (5)
 > $\mathrm{RealBox}\left(2.3\right)\mathrm{RealBox}\left(-4.7\right)$
 ${⟨}{\text{RealBox:}}{-10.81}{±}{3.09665ⅇ-09}{⟩}$ (6)
 > $17.41\mathrm{RealBox}\left(-4.7\right)$
 ${⟨}{\text{RealBox:}}{-81.827}{±}{2.43122ⅇ-08}{⟩}$ (7)
 > $\frac{\mathrm{RealBox}\left(2.3\right)}{\mathrm{RealBox}\left(-4.7\right)}$
 ${⟨}{\text{RealBox:}}{-0.489362}{±}{1.60597ⅇ-10}{⟩}$ (8)
 > ${\mathrm{RealBox}\left(2.3\right)}^{\mathrm{RealBox}\left(-4.7\right)}$
 ${⟨}{\text{RealBox:}}{0.0199471}{±}{2.91557ⅇ-11}{⟩}$ (9)
 > ${\mathrm{RealBox}\left(2.3\right)}^{3.1415}$
 ${⟨}{\text{RealBox:}}{13.6889}{±}{1.36337ⅇ-08}{⟩}$ (10)
 > ${\mathrm{RealBox}\left(2.3\right)}^{2}$
 ${⟨}{\text{RealBox:}}{5.29}{±}{1.53668ⅇ-09}{⟩}$ (11)
 > ${\mathrm{RealBox}\left(2.3\right)}^{10}$
 ${⟨}{\text{RealBox:}}{4142.65}{±}{4.40901ⅇ-06}{⟩}$ (12)
 > $p≔-7{x}^{5}+22{x}^{4}-55{x}^{3}-94{x}^{2}+87x-56$
 ${p}{≔}{-}{7}{}{{x}}^{{5}}{+}{22}{}{{x}}^{{4}}{-}{55}{}{{x}}^{{3}}{-}{94}{}{{x}}^{{2}}{+}{87}{}{x}{-}{56}$ (13)
 > $\genfrac{}{}{0}{}{p}{\phantom{x=\mathrm{RealBox}\left(2.3\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{p}}{x=\mathrm{RealBox}\left(2.3\right)}$
 ${⟨}{\text{RealBox:}}{-857.239}{±}{1.30933ⅇ-06}{⟩}$ (14)
 > $\genfrac{}{}{0}{}{p}{\phantom{x=2.3}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{p}}{x=2.3}$
 ${-857.23881}$ (15)
 > $q≔-62{x}^{4}+97{x}^{3}-73{x}^{2}-4x-83$
 ${q}{≔}{-}{62}{}{{x}}^{{4}}{+}{97}{}{{x}}^{{3}}{-}{73}{}{{x}}^{{2}}{-}{4}{}{x}{-}{83}$ (16)
 > $\genfrac{}{}{0}{}{\left(\frac{p}{q}\right)}{\phantom{x=\mathrm{RealBox}\left(2.3\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{\left(\frac{p}{q}\right)}}{x=\mathrm{RealBox}\left(2.3\right)}$
 ${⟨}{\text{RealBox:}}{0.829705}{±}{2.97047ⅇ-09}{⟩}$ (17)
 > $\genfrac{}{}{0}{}{\left(\frac{p}{q}\right)}{\phantom{x=2.3}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{\left(\frac{p}{q}\right)}}{x=2.3}$
 ${0.8297048874}$ (18)

Let's try a bivariate polynomial.

 > $p≔-40{x}^{3}{y}^{2}+42x{y}^{4}-7{x}^{4}-10{x}^{2}y-75xy-17x$
 ${p}{≔}{-}{40}{}{{x}}^{{3}}{}{{y}}^{{2}}{+}{42}{}{x}{}{{y}}^{{4}}{-}{7}{}{{x}}^{{4}}{-}{10}{}{{x}}^{{2}}{}{y}{-}{75}{}{x}{}{y}{-}{17}{}{x}$ (19)

First evaluate x

 > $q≔\genfrac{}{}{0}{}{p}{\phantom{x=\mathrm{RealBox}\left(2.3\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{p}}{x=\mathrm{RealBox}\left(2.3\right)}$
 ${q}{≔}{⟨}{\text{RealBox:}}{-234.989}{±}{1.35785ⅇ-07}{⟩}{+}\left({⟨}{\text{RealBox:}}{-486.68}{±}{2.3488ⅇ-07}{⟩}\right){}{{y}}^{{2}}{+}\left({⟨}{\text{RealBox:}}{96.6}{±}{1.72295ⅇ-08}{⟩}\right){}{{y}}^{{4}}{+}\left({⟨}{\text{RealBox:}}{-52.9}{±}{1.90921ⅇ-08}{⟩}\right){}{y}{+}\left({⟨}{\text{RealBox:}}{-172.5}{±}{3.23635ⅇ-08}{⟩}\right){}{y}$ (20)

Then evaluate at y

 > $\genfrac{}{}{0}{}{q}{\phantom{y=\mathrm{RealBox}\left(0.55\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{q}}{y=\mathrm{RealBox}\left(0.55\right)}$
 ${⟨}{\text{RealBox:}}{-497.34}{±}{4.13754ⅇ-07}{⟩}$ (21)

Now let's check that we get the same result if we first evaluate at y and then evaluate the result at x.

 > $q≔\genfrac{}{}{0}{}{p}{\phantom{y=\mathrm{RealBox}\left(0.55\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{p}}{y=\mathrm{RealBox}\left(0.55\right)}$
 ${q}{≔}\left({⟨}{\text{RealBox:}}{-12.1}{±}{4.65661ⅇ-09}{⟩}\right){}{{x}}^{{3}}{+}\left({⟨}{\text{RealBox:}}{3.84326}{±}{1.99043ⅇ-09}{⟩}\right){}{x}{-}{7}{}{{x}}^{{4}}{+}\left({⟨}{\text{RealBox:}}{-5.5}{±}{1.04774ⅇ-09}{⟩}\right){}{{x}}^{{2}}{+}\left({⟨}{\text{RealBox:}}{-41.25}{±}{8.09086ⅇ-09}{⟩}\right){}{x}{-}{17}{}{x}$ (22)
 > $\genfrac{}{}{0}{}{q}{\phantom{x=\mathrm{RealBox}\left(2.3\right)}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}|\phantom{\rule[-0.0ex]{0.1em}{0.0ex}}\genfrac{}{}{0}{}{\phantom{q}}{x=\mathrm{RealBox}\left(2.3\right)}$
 ${⟨}{\text{RealBox:}}{-497.34}{±}{4.05442ⅇ-07}{⟩}$ (23)

Compatibility

 • The RealBox[Arithmetic], RealBox:-+, RealBox:-*, RealBox:-^, RealBox:-- and RealBox:-/ commands were introduced in Maple 2022.