Am Donnerstag, den 09.07.2009, 11:25 -0500 schrieb Barton Willis:
> How can I suppress the error message (Division by zero in this case) in a
> function
> such as: (the function f is just a toy---I wasn't wanting to do anything
> like this)
>
> (%i7) f(a,b) := (a : errcatch(a/b), if a = [] then 'und else first(a));
> (%o7) f(a,b):=(a:errcatch(a/b),if a=[] then 'und else first(a))
> (%i8) f(0,0);
> Division by 0
> (%o8) und
>
> I think I've asked about this before, but I can't find it or remember the
> trick.
The following works for me:
(%i6) f(a,b) := block( [?errorsw:t],a : errcatch(a/b), if a = [] then
'und else first(a))$
(%i7) f(0,0);
(%o7) und
In simpexpt the error message can be suppressed setting the switch
errorsw to true.
Dieter Kaiser