Representing the case "no result"



On 6/6/09, Dieter Kaiser <drdieterkaiser at web.de> 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.

Agreed.

> (%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.

I dunno. Returning 'divergent is suboptimal but it's better than
triggering an error. How about 'divergent('integrate(...)) i.e. smash
the offending expression in the return value (or make the expression
a property of the return value). It might be a good idea to tag the
'divergent with a gensym somehow so that we avoid stuff like
'divergent - 'divergent => 0.

Whatever we decide with integrate should probably be applied
to limit as well, since limit now returns ind and und.

> Is it a good idea to use the empty list [] to represent the case that we
> have NO RESULT, but NO ERROR?

Opposed. [] is a valid return value in other, commonly-encountered, contexts.
Also, it doesn't carry any info about the original expression.

> 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)]?

Well, if the return value is something other than [] this
doesn't matter so much. But for the record, I'm in favor
of such a convention only if it is implemented via a
declaration like declare(sin, distributes_over ("[")).

I'm opposed to any implementation which requires hacking
on the simplifier for each affected function.
There's already too much of that in Maxima.

best

Robert Dodier