# [Maxima] suppressing error messages

Barton Willis willisb at unk.edu
Thu Jul 9 14:30:46 CDT 2009

```Ugh. Some of us routinely name files jnk.txt. Surely there is a better
way.

(%i1) f(a,b) := block([errormsg : false], a : errcatch(a/b), if a = []
then 'und else first(a))\$

But this doesn't work:

(%i2) f(0,0);
Division by 0
(%o2) und

(%i3) f(0,0);

(%o3) und

Barton

maxima-bounces at math.utexas.edu wrote on 07/09/2009 02:13:26 PM:

> [image removed]
>
> Re: [Maxima] suppressing error messages
>
> Richard Hennessy
>
> to:
>
> Barton Willis, Maxima Mailing List
>
> 07/09/2009 02:13 PM
>
> Sent by:
>
> maxima-bounces at math.utexas.edu
>
> f(a,b) := with_stdout("c:/jnk.txt", a : errcatch(a/b), if a = []
> then 'und else first(a));
>
>
> ----- Original Message -----
> From: "Barton Willis" <willisb at unk.edu>
> To: "Maxima Mailing List" <maxima at math.utexas.edu>
> Sent: Thursday, July 09, 2009 12:25 PM
> Subject: [Maxima] suppressing error messages
>
>
> 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
>
the
> trick.
>
>
> Barton
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

```