sinc(x) -- defining evaluating and simplifying operations



>>>>> "Stavros" == Stavros Macrakis <stavros.macrakis@verizon.net> writes:

    >> I wanted to define the sinc(x) function:
    >> 
    >> (C1) sinc(x) := if (x = 0) then 1 else sin(x)/x;
    >> ...
    >> (C4) sinc(x);
    >> SIN(x)
    >> (D4)                                ------
    >> x
    >> Well, that's not right.

    Stavros> There are three problems with that definition.

[snip very nice description and solution]
    Stavros> The third problem is that you're using a function to define this; but if
    Stavros> you want automatic resimplification, you need to define a *simplifying*
    Stavros> operation.  Patterns are how you define a *simplifying* operator at the

Well, the context was that I needed to evaluate sin(x)/x when testing
the quadpack integration routines.  One of the integrators wants to
evaluate at 0, and I get division by zero error.  So I wasn't really
interested in all the other stuff right now, but it is very good to
know how to do this.

Ray