MathematicalFunctions[Evalf]
Evalb
works as 'evalb' but handles boolean expressions involving the functions as And, Or, Not and extending the integer types 'integer', 'posint', etc. to handle floating-point numbers
Calling Sequence
Parameters
Description
Examples
Compatibility
Evalb(boolean_expression)
boolean_expression
-
any valid maple construction, typically an algebraic boolean_expression built with the operators and, or, or the boolean functions And, Or, Not, etc. and the type operator `::`
The Evalb command works the same way as the standard evalb command in that it forces the evaluation of expressions involving relational operators, using a three-valued logic system. The return values are true, false, and FAIL. If evaluation is not possible, an unevaluated expression is returned.
Unlike evalb, however, Evalb also handles the boolean functions And, Or, Not, etc. and extends the integer types integer, negint, nonnegint, posint, nonposint, even and odd to handle floating-point numbers in equal footing as exact numbers. So, within the context of Evalb, both 4 and 4.0 are of type integer and even. This is particularly useful when writing numerical evaluation routines using these integer types. For example: for most functions, special cases happen when some of the parameters are integers, or non-negative integers.
Likewise, the ability to handle constructions using And, Or, Not, etc. permits writing these procedures with a rather simple syntax since these boolean functions are not automatically executed and the constructions using these boolean functions can be nested with no restrictions.
with⁡MathematicalFunctions:-Evalf
Add,Evalb,Zoom,QuadrantNumbers,Singularities,GenerateRecurrence,PairwiseSummation
When writing numerical procedures, the expressions or mathematical functions to be numerically evaluated have special cases for integer values of their parameters. For example, consider the 2F1 hypergeometric series - its sum form can be seen using the FunctionAdvisor:
FunctionAdvisor⁡sum,hypergeom
* Partial match of "sum" against topic "sum_form".
F12⁡a,b;c;z=∑_k1=0∞⁡a_k1⁢b_k1⁢z_k1_k1!⁢c_k1,a::ℤ0,−∧c≠a+1∨z<1∨z=1∧0<−ℜ⁡−c+a+b∨z=1∧z≠1∧−ℜ⁡−c+a+b∈−1,0
In this definition we see a pochhammer function in the denominator, so when the parameter c is a nonnegative integer, the sum will diverge when the summation index, k1, is bigger than the absolute value of c, because in those cases pochhammer(c, _k1) will be equal to 0 in the denominator. In turn, when either of a or b are nonnegative integers, the pochhammer functions in the numerator will be zero at some point, truncating the series so that the 2F1 function is a polynomial. And when both things happen at the same time, the function will be a polynomial if the absolute value of a or b is smaller or equal to the absolute value of c, and will be divergent (as in division by zero) otherwise.
The condition for divergence can thus be written using And, Or and Not as follows:
AndAndc∷nonposint, Ora∷Notnonposint, absc < absa, Orb∷Notnonposint, absc < absb
c::ℤ0,−∧a::¬ℤ0,−∨c<a∧b::¬ℤ0,−∨c<b
Thus, using Evalb, you can construct a numerical procedure that first checks for this divergent case, and only forwards the problem to hypergeom for numerical evaluation directly using the condition for divergence above:
F ≔ a,b,c,z→ifEvalb⁡And⁡c::nonposint,Or⁡a::Not⁡nonposint,c<a,Or⁡b::Not⁡nonposint,c<bthenerrordivision by zeroelseevalf⁡'hypergeom'⁡a,b,c,zfi
F≔a,b,c,z↦ifEvalb⁡c::ℤ0,−∧a::¬ℤ0,−∨c<a∧b::¬ℤ0,−∨c<bthenerrordivision by zeroelseevalf⁡hypergeom⁡a,b,c,zendif
Note the simplicity in which the condition got expressed and, due to using Evalb, this condition also works as expected with floating-point numbers. For example, the following input, where c = -3.0, interrupts with division by zero
F⁡−4.0,3,−3.0,0.5,0.3
Error, (in F) division by zero
while the following input, where c=−4.0 forwards the problem to hypergeom where the computation is performed
F⁡−4.0,3,−4.0,0.5,0.3
6.18750000
The MathematicalFunctions[Evalf][Evalb] command was introduced in Maple 2017.
For more information on Maple 2017 changes, see Updates in Maple 2017.
See Also
Appell
evalb
evalf
Evalf command
Evalf package
FunctionAdvisor
hypergeom
MathematicalFunctions
Download Help Document