Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The NumericEventHandler, sometimes it works, sometimes it does not.

27 views
Skip to first unread message

Peter Luschny

unread,
Jan 18, 2018, 8:12:05 AM1/18/18
to
restart;
ln(0);
tan(Pi/2);

#> Error, (in ln) numeric exception: division by zero
#> Error, (in tan) numeric exception: division by zero

# Now we replace the NumericEventHandler for division by zero.
NumericEventHandler(division_by_zero = proc(operator,operands,defVal) -infinity end):

ln(0);
tan(Pi/2);

#> -infinity
#> -infinity

# So far so good. Now define

restart;
gammaquot := (n, k) -> limit(GAMMA(n+1+x)/(GAMMA(k+1)*GAMMA(n-k+1+x)), x=0);
gammaquot(-1,-1);
#> Error, (in GAMMA) numeric exception: division by zero

restart;
NumericEventHandler(division_by_zero = proc(operator,operands,defVal) -infinity end):
gammaquot := (n, k) -> limit(GAMMA(n+1+x)/(GAMMA(k+1)*GAMMA(n-k+1+x)), x=0);
gammaquot(-1,-1);

#>0

# Q1: Why is the NumericEventHandler not used here?
# Q2: What is the correct value of gammaquot(-1,-1)?

asetof...@gmail.com

unread,
Jan 22, 2018, 3:50:27 AM1/22/18
to
I don't know Maple language, but for me "exceptions handle" can not be used on all different of catch few 1 or 2 type of error(write out memory reserved and don't know other) error
0 new messages