STACK: How to check if a point is in a domain of a function given by the student?

Re: STACK: How to check if a point is in a domain of a function given by the student?

by Luiz Gustavo Cordeiro -
Number of replies: 2
More specifically, this is the error I get with division by zero:

Division by zero. Division by zero. Node PRSANS1 generated the following runtime error: Division by zero.
In reply to Luiz Gustavo Cordeiro

Re: STACK: How to check if a point is in a domain of a function given by the student?

by Robert Mařík -

In Maxima you can evaluate in errcatch command which prevents to issue the error and returns empty list instead. See the Maxima manual. The following code returns 1 if ans1 is undefined at x0 and 0 otherwise.

x0:4;
ans1:sin(x-3)/(x-3);
ans2:errcatch(subst([x=x0],ans1));
if ans2=[] then 1 else 0;