## #1253 integrate( (x^3+1)/(x^4 + 4*x + 1), 0, 1);

closed
nobody
5
2007-10-24
2007-08-21
Anonymous
No

Maxima: 5.11.0
Lisp: SBCL 1.0.3

On the mailing list, I asked about a definite integral that seems to
make Maxima hang.

-8<------------
(%i1) integrate( (x^3+1)/(x^4 + 4*x + 1), x);
4
log(x + 4 x + 1)
(%o1) -----------------
4
(%i2) integrate( (x^3+1)/(x^4 + 4*x + 1), x, 0, 1);

[... no output, sblc cpu usage at 87% ...]
---------------

Barton Willis replied and suggested to file a bug report.

He said:
>
> To see in part what is going on, try this:
>
> (%i4) trace(?csign);
> (%o4) [csign]
> (%i5) integrate( (x^3+1)/(x^4 + 4*x + 1), x, 0, 1);
>
> --> Yikes! all kinds of junk!
>
> Also try integrate((x^3+1)/(x^4 + 4*x + 1), x,a,b).
>
> I suppose that Maxima is struggling to show that the antiderivative
> is continuous on [0,1]. But Maxima goes about it in just about the
> worst of all possible ways. Maxima does know that x^4 + 4*x + 1 is
> positive > for x in [0,1], so it should be able to determine that
> log(x^4 + 4*x + 1) is continuous on [0,1].
>
> (%i1) assume(x >= 0, x<=1);
> (%o1) [x>=0,x<=1]
> (%i2) sign(x^4 + 4*x + 1);
> (%o2) pos

## Discussion

• Raymond Toy - 2007-10-19

Logged In: YES
user_id=28849
Originator: NO

A summary of some e-mails.

Maxima has converted the integral to a contour integral around a keyhole contour (circle with a slit on the positive real axis). The denominator is a quartic with 4 complex (and messy) roots. Maxima is using residues to evaluate the integral.

If you wait long enough (and have enough memory), maxima does finally finish. (It took some hour or two). The result is too long to display, but if I bfloat the resullt, I get the expected numerical answer. (Which is a little surprising because there are some very large integers of 50+ digits or more in the result.)

Since this is a rational function, I tried an experiment with ratfnt trying to do the antiderivative first before trying the contour integral. This works, and doesn't cause the test suite to fail. Two tests do fail, but that is because the form of the answer has changed, not the value.

• Raymond Toy - 2007-10-24
• status: open --> closed

• Raymond Toy - 2007-10-24

Logged In: YES
user_id=28849
Originator: NO

Fixed in defint.lisp, rev 1.52.

We try the antiderivative first and if that fails, we try the keyhole contour.