ScientificErrorAnalysis - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Scientific Error Analysis : Commands : ScientificErrorAnalysis/GetRule

ScientificErrorAnalysis

 GetRule
 return the procedure of a rounding rule

 Calling Sequence GetRule( name )

Parameters

 name - symbol; name of an available rule

Description

 • The GetRule( name ) command returns the procedure that performs the action of the rule name.
 There is no procedure available for the rule 'digits'.
 • For more information on predefined rules in ScientificErrorAnalysis, see Predefined Rounding Rules.

Examples

 > $\mathrm{with}\left(\mathrm{ScientificErrorAnalysis}\right):$
 > $\mathrm{GetRule}\left(\mathrm{round}\right)$
 ${\mathbf{proc}}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{xp}}{,}{\mathrm{yp}}{,}{n}{,}{\mathrm{usen}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{procname}}{,}{'}{\mathrm{indexed}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{error}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"round must be indexed"}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{n}{≔}{\mathrm{op}}{}\left({\mathrm{procname}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({n}{,}{'}{\mathrm{posint}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{error}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"invalid index to round"}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{xp}}{,}{\mathrm{yp}}{≔}{\mathrm{evalf}}{}\left({x}\right){,}{\mathrm{evalf}}{}\left({y}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{xp}}{<>}{0}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{usen}}{≔}{n}{+}{\mathrm{ilog10}}{}\left({\mathrm{SFloatMantissa}}{}\left({\mathrm{xp}}\right)\right){-}{\mathrm{ilog10}}{}\left({\mathrm{SFloatMantissa}}{}\left({\mathrm{yp}}\right)\right){+}{\mathrm{SFloatExponent}}{}\left({\mathrm{xp}}\right){-}{\mathrm{SFloatExponent}}{}\left({\mathrm{yp}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{usen}}{,}{'}{\mathrm{integer}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{usen}}{<}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{0.}{,}{\mathrm{evalf}}{[}{n}{]}{}\left({\mathrm{yp}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{evalf}}{[}{\mathrm{usen}}{]}{}\left({\mathrm{xp}}\right){,}{\mathrm{evalf}}{[}{n}{]}{}\left({\mathrm{yp}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{evalf}}{[}{n}{]}{}\left({\mathrm{xp}}\right){,}{\mathrm{evalf}}{[}{n}{]}{}\left({\mathrm{yp}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{0.}{,}{\mathrm{evalf}}{[}{n}{]}{}\left({\mathrm{yp}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (1)