On 5/23/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> > I would prefer to have a separate function for numerical integration.
>
> Why? We don't have a separate function for numerical evaluation of sin; why
> should we have a separate function for numerical evaluation of integrals?
There is a difference when maxima can compute the antiderivative. What
would you expect from integrate(x*tan(x/3), x, 0.0, 1.0). Maxima knows
how to compute the antiderivative and then returns something
containing limits. That's why I want a function which computes
integrals strictly by numerical methods without trying integrate
first. integrate with numerical bounds should do something different.
> > > nintegrate(q,x,a,b) => no change
> >
> > [it] should return unchanged.
>
> Why shouldn't it return (b-a)*q just like symbolic integration?
This depends on what you expect nintegrate to do. Do you want it to
get a numerical value by combining the knowledge of integrate and
quadpack or you want to get the numerical value from quadpack. I want
nintegrate to use only numerical methods. It should return a numerical
result or unevaluated.
> By the way, here are some more bugs:
>
> nintegrate(1/x,x,-1,1) => T is not of type (or rational lisp:float)
> nintegrate(lambda([x],1/x),x,-1,1) => Division by
> zero
> nintegrate(lambda([x],print(x),1/x),x,-1,1) => Error
> number 2
> ( l:[],
> nintegrate(lambda([x],l:cons(x,l),1/x^2),x,-1,1) => NIL is
> not of type...
These are bugs in quad_qags not nintegrate (or coerce-float-fun). I
think hey are all division by zero errors.
About errors I agree that if quadpack correctly detects an error then
nintegrate should print it and return unevaluated without producing an
error.
--
Andrej