"Torture" integral solved Message #11 Posted by Valentin Albillo on 15 Dec 2005, 9:16 a.m., in response to message #10 by Marcus von Cube, Germany
Hi, Marcus:
Marcus posted:
"A simple aproach is to replace the lower boundary by something above zero [...] Smaller boundaries make things worse!"
Yes, they do. That the result you get with your lower boundary somewhat resembles the correct value is just a coincidence.
"Variable substitution doesn't seem to get rid of the oscillations and I get an infinite boundary instead."
True, but this is one possible way to deal with this integral.
The change:
t = log(x)
results in:
Integral = Integral(0, Inf, cos(t.e^{t}))
= Integral(0, Inf, cos(W^{1}(t)))
where W(x) is Lambert's W function. You can then find the integral by subdividing the (0,Inf) original interval in subintervals and thus integrating between the zeros of cos(W^{1}(t)), thus getting an slowly convergent alternating series that can be accelerated by a number of methods (see my HP11C Datafile article, for example). This results in an accurate value for the integral but, as you correctly guessed, there's a faster, simpler way:
"There are ways to tackle such problems by integrating in the complex plane"
That's right. You just need to remember that
e^{ix} = cos(x) + i*sin(x)
and the original integral becomes:
Integral = Integral(0, 1, RealPart(e^{(i*log(x)/x)}/x))
= Integral(0, 1, RealPart(x^{i/x1}))
which can readily be integrated by considering it a line integral in the complex plane along some integration path. A simple parabolic path will do:
z = t + t*(1t)*i
which takes us far from the oscillations of the real line. Using this path, your faithful HP71B can compute the integral to full 12digit precision in a few minutes, as follows:
10 DESTROY ALL @ COMPLEX Z @ SFLAG 1 @ DISP INTEGRAL(0,1,1E9,FNY(IVAR))
20 DEF FNY(T) @ Z=(T,TT*T) @ FNY=REPT(Z^((0,1)/Z1)*(1,12*T))
>RUN
.323367431678
which, as stated, is the correct result rounded to the 12 decimal digits shown. The HP15C solution is a mere verbatim translation of this 2line 'program'.
This technique of computing difficult realline integrals by taking them to the complex plane is actually very useful in many situations, and is discussed at length, with an example, in the marvelous HP15C Advanced Functions Handbook.
Thanks for your interest and best regards from V.
Edited: 15 Dec 2005, 9:19 a.m.
