When Does quad_qagi Evalute?



On 2013-08-28, Sean Lake <odysseus9672 at gmail.com> wrote:

> f(x,y) := exp( - ( y - x - log( 1 +exp(y))/3)^2 / 2);
> N(x) := quad_qagi( f(x, y), y, minf, inf )[1];
> plot2d( N(x), [x, -5, 5] );
>
> When I try to evaluate N(0.0), I get what looks like an unevaluated
> noun form

quad_qagi tries to evaluate log(exp(y) + 1) for large y, and gets a
floating point error, at which point it gives up. (Try :lisp (trace
simpexpt) and then call quad_qagi to see that.) The only way around
it is to rephrase the integrand so it doesn't cause an error. Maybe
you can replace log(exp(y) + 1) by a rational approximation or
just y for large enough y.

Incidentally the part from minf to 0 doesn't seem to cause any trouble.

> (you'll need a fixed width font for this to make sense):

Try display2d:false to get output to paste into emails.

best

Robert Dodier