Evalb - Maple Help

Online Help

All Products    Maple    MapleSim


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

Calling Sequence

Evalb(boolean_expression)

Parameters

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 `::`

Description

• 

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.

Examples

withMathematicalFunctions:-Evalf

Add,Evalb,Zoom,QuadrantNumbers,Singularities,GenerateRecurrence,PairwiseSummation

(1)

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:

FunctionAdvisorsum,hypergeom

* Partial match of "sum" against topic "sum_form".

F12a,b;c;z=_k1=0a_k1b_k1z_k1_k1!c_k1&comma;a::nonposintca+1z<1z=10<c+a+bz=1z1c+a+b−1&comma;0

(2)

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:

AndAndcnonposint&comma; OraNotnonposint&comma; absc < absa&comma; OrbNotnonposint&comma; absc < absb

c::nonposinta::¬nonposintc<ab::¬nonposintc<b

(3)


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:

Fa&comma;b&comma;c&comma;z&rarr;ifEvalbAndc::nonposint&comma;Ora::Notnonposint&comma;c<a&comma;Orb::Notnonposint&comma;c<bthenerrordivision by zeroelseevalf&apos;hypergeom&apos;a&comma;b&comma;c&comma;zfi

Fa&comma;b&comma;c&comma;zifEvalbc::nonposinta::¬nonposintc<ab::¬nonposintc<bthenerrordivision by zeroelseevalfhypergeoma&comma;b&comma;c&comma;zendif

(4)

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

F4.0&comma;3&comma;3.0&comma;0.5&comma;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

F4.0&comma;3&comma;4.0&comma;0.5&comma;0.3

6.18750000

(5)

Compatibility

• 

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