This is a very good question. There are several related issues. In
logic I think there is a similar concept associated with the symbol
"bottom" which looks like an upside-down T.
There is also the empty SET which might be different from the LIST with
no elements. There is the case of a limit not existing, where
"undefined" is returned. There is the possibility of an interval with
no elements in it, like the interval [1,-1]. (Although some people,
myself included, might use this for [-inf,-1]+[1,inf].) or interval
[inf,-inf].
There is the case of solution sets from solve where there are no
solutions, e.g. sin(realpart(x))= 2.
I think that the solution of making functions map over lists so that
sin([]) becomes [] is interesting, but conflicts with the use of []
as a list!
For example, append([a,b],[]) is [a,b], not []. If you had another
symbol for "undefined" you might say that
append([a,b],undefined) = undefined.
If we revise the system so that it routinely returns SETS for answers
when there is more than one, or even when there is one, then the empty
set may make sense.
e.g.
solve(x^2-4=0,x) --> {-2,2}
divergent integral --> message , returns {}
At this point the same question comes up when you consider the result of
using a set operation like union: union({a},{}) is {a}.
Some of this comes from Maxima allowing any type object to appear in
almost any context, and trying to do something with it.
A strongly typed system would not allow you to compute the union of a
set and something that is not a set at all.
It seems to me that a no-such-object like "bottom" is logically most
consistent, where indeed f(...,bottom,...) is bottom for all f.
There is a IEEE floating-point object (really a large number of them)
called NotaNumber (NaN) which has this contagious property.
Perhaps this could be used, though treatment of NaNs by different Lisp
systems may not be consistent.
GCL or perhaps wxmaxima refuses to print a NaN. (to make one, I first
made an infinity by (expt 2.0 50000) and then (- infinity infinity)
should be a NaN.)
Dieter Kaiser wrote:
> I think it would be a good idea to remove the call of merror in cases
> like a definite integral which is divergent, e.g.
>
> (%i25) integrate(x,x,0,inf);
> defint: integral is divergent.
> -- an error. To debug this try debugmode(true);
>
> There are two reasons:
> First, we get problems with the assume database see bug report ID
> [626607] "Defint doesn't clean up asksign db"
> Second, it is no error in Maxima to get a divergent integral.
>
> It is easy to remove the call to merror and do something like:
>
> (%i27) integrate(x,x,0,inf);
> defint: The integral is divergent.
> (%o27) 'divergent
>
> But it is problematic to return a symbol, because we get a lot of wrong
> results, when the integral is part of an expression (I think the
> problems are known). This is the case for 'inf and 'minf too.
>
> Furthermore, it is not a good idea to return a noun form for a divergent
> integral, because the noun form represents the case that Maxima is not
> able to solve the integral.
>
> I think we have no convention for cases like this: We have NO RESULT,
> but we have NO ERROR too.
>
> I have tried the following solution: The case NO RESULT is represented
> by an empty list.
>
> (%i29) integrate(x,x,0,inf);
> defint: The integral is divergent.
> (%o29) []
>
> One advantage is, that the standard arithmetic will not change the
> result "NO RESULT". The empty list simplifies to the empty list.
>
> (%i33) a*(integrate(x,x,0,inf))^b;
> defint: The integral is divergent.
> (%o33) []
>
> We have a problem with functions. Because functions do not automatically
> map over lists we get something like
>
> (%i34) sin(integrate(x,x,0,inf))^b;
> defint: The integral is divergent.
> (%o34) sin([])^b
>
> When we introduce the automatic mapping of functions over lists we can
> improve this e.g.
>
> (%i35) expintegral_ei(integrate(x,x,0,inf))^b;
> defint: The integral is divergent.
> (%o35) []
>
> (%i36) expintegral_e(order,integrate(x,x,0,inf))^b;
> defint: The integral is divergent.
> (%o36) []
>
> So we have two questions to discuss:
>
> 1.
>
> Is it a good idea to use the empty list [] to represent the case that we
> have NO RESULT, but NO ERROR?
>
> 2.
>
> Should we introduce in addition the convention, that functions may map
> automatically over lists, e.g. sin([a,b,c]) --> [sin(a),sin(b),sin(c)]?
>
>
> I think it is important to have a consistent convention to represent
> situations like a divergent integral. The empty list might be a way to
> do it.
>
> The automatic mapping of functions over lists could be implemented step
> by step and would help to get consistent results, when we introduce the
> empty list to represent a divergent integral.
>
> Dieter Kaiser
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>