nintegrate - second attempt



On 5/24/07, Barton Willis <willisb at unk.edu> wrote:
> Maybe nintegrate should handle complex valued integrands more gracefully:

nintegrate handles complex valued integrands funny - this is because
of the coerce-float-fun design. nintegrate(expr, x,a,b) is equivalent
to nintegrate(realpart(expr),x,a,b); I think this is wrong but I
didn't write coerce-float-fun. A similar problem was discussed for
plotting functions when plot_realpart option was introduced
(coerce-float-fun is used in plot functions also).

> OK:
>
> (%i2) nintegrate(x, x, 0, 1);
> (%o2) 0.5
>
> Not OK:
>
> (%i3) nintegrate(x + %i, x, 0, 1);
> (%o3) 0.5

this is equivalent to nintegrate(realpart(x+%i), x, 0,
1)=integrate(x,x,0,1); You can set *plot-realpart* lisp variable to
false and it should return unevaluated.

> OK, but why not 0.5 * %i?
>
> (%i4) nintegrate(%i, x, 0, 1);
> (%o4) nintegrate(%i,x,0,1)

I don't think quadpack can do integration of complex valued functions,
so this is OK in my opinion. nintegrate(x+%i,x,0,1) should also return
unevaluated.

-- 
Andrej