sinc(x) -- defining evaluating and simplifying operations



Raymond Toy:

> > (C1) sinc(x) := if (x = 0) then 1 else sin(x)/x;

Stavros Macrakis wrote: 

> > There are three problems with that definition.

Robert Dodier:

> I don't see anything wrong with the definition. I'd like
> to turn the problem around: What would it take for Maxima
> to understand such a thing?

Again, there are three kinds of responses to this kind of issue: the
immediate, "how do I solve my problem" response (often related to a
misunderstanding about the current behavior), and the longer-term, "what
is the underlying issue and can it be fixed" response, discussing design
issues.  The definition really *is* "wrong" in the current system, but
it does bring up some design issues:

First of all, Maxima's notion of a *mathematical* function (as opposed
to a programming function, probably better called a subroutine or
something) is rather weak.

Secondly, users are often confused about issues relating to evaluation,
noun forms, variable scope, and the like.  In trying to do the "obvious
thing" in various areas (sum, plot2d, integrate, ev, makelist, lambda,
etc.), Maxima has ended up with a mish-mash of inconsistent conventions,
none of them completely satisfactory.  This is documented in (among
others) my bug report #740130.  Some of the most common new-user issues
in Maxima have to do with evaluation of the first argument of plot2d,
and the semantics of EV.

Third, Maxima does not handle unevaluated conditionals.  This is again
something I've wanted to add for a while, but it is not easy to do
right.  Of course, it is trivial to do badly....  In fact, it exists
already: just write '"if"(cond,trueclause,falseclause).  But this is not
very useful.

> That "=" is the wrong kind of equality, seems simply 
> capricious; but I'll leave that aside for now.

It is not at all capricious.  It comes from the conflation of
manipulation of mathematical objects like functions and real values and
the manipulation of symbolic expressions.  It also comes from the
impossibility (in general) of testing for equality of mathematical
value.

Now, I *do* agree it is confusing for many users, and perhaps a better
design could be found.  On the other hand, the only reason the issue
comes up at all is that Maxima is very "user-friendly" in *not*
requiring explicit declarations of object types, etc.  I am all for
coming up with a better solution.  But I'm not sure that the solution is
to give "=" the semantics of Equal.

All of these issues have long histories, and are not as trivial as you
might think.

      -s