On Monday 14 April 2003 12:49, Nikolaos I. Ioakimidis wrote:
> Perhaps, you can use the command ldefint for this definite
> integration. This uses the conmmand limit on the indefinite
> integral (a different approach) before the computation of
> the definite integral. My successful attempt and verification
> of the result numerically:
>
> (C1) display2d : false$
> (C2) int : ldefint(1/(cos(x)+sin(x)),x,0,%pi/4), logcontract;
> (D2) LOG(-SQRT(2)/(SQRT(2)-2))/SQRT(2)
> (C3) [float(int), romberg(1/(cos(x)+sin(x)),x,0,%pi/4)];
> (D3) [0.62322524014023,0.62322575884376]
Thank you. This seems to work very well even for more complicated integrands
and for integration over singularities (note that I haven't verified my
results yet). However, Maxima often asks many questions even if the result is
independent of the answers (also see my post "Why does integrate ask so many
questions?" from April 10). I guess the reason is that integrate (or idefint)
sometimes wants to divide by an expression or take a real valued square root
of an expression. Couldn't it just put off such a task and try something else
instead (this might of course be more time consuming).
> If you wish to use the integrate command, then you have
> to change the value of the option variable intanalysis in
> a separate command (or in the same command with integrate):
>
> (C1) intanalysis : false$
> (C2) int1 : integrate(1/(cos(x)+sin(x)),x,0,%pi/4), logcontract;
> (D2) -SQRT(2)*LOG((SQRT(2)+1)/(2*SQRT(2)+3))/2
> (C3) [float(int1), romberg(1/(cos(x)+sin(x)),x,0,%pi/4)];
> (D3) [0.62322524014023,0.62322575884376]
>
> intanalysis : true (the default) makes a complete convergence test
> before the actual integration, which sometimes fails as happened
> in your case. Now, no convergence test any more, but the result
> seems to be correct compared with Romberg's numerical integration
> related result (and the previous result of ldefint as well).
Maxima really seems to be very powerful when it comes to integration. I guess
I need to RTFM to get accustomed to all these features. Only if the
documentation were better, e.g. in the info pages I find
- Function: DEFINT (exp, var, low, high)
DEFinite INTegration, the same as INTEGRATE(exp,var,low,high).
But this is unaccurate: as you showed above, integrate and defint are not
identical (they are of course identical from the mathematical point of view).
Felix