Unwanted definite-integral complex result from real integrand

*To*: mathgroup at smc.vnet.net*Subject*: [mg21422] Unwanted definite-integral complex result from real integrand*From*: uhap023 at vms.rhbnc.ac.uk (Tom Crane)*Date*: Thu, 6 Jan 2000 01:46:37 -0500 (EST)*Organization*: Dept. Physics, Royal Holloway, University of London*Sender*: owner-wri-mathgroup at wolfram.com

Dear All, Can anybody help me with the following problem? I am trying to do a definite integral on a real expression but Mathematica always returns a complex result. I need a real result and believe the result should be real. Moveover, I want to produce a Fortran function of the result and even if I were to use Fortran's complex datatype, terms of the form CosIntegal(x+Iy) in the result are a problem since I want to use external functions (eg. NAG library) to evaluate these special functions. My integrand is, (g*t1*(t - t1 + t*t1^2*(wa + wb)^2 + t1^3*(wa + wb)^2))/ (1 + t1^2*(wa + wb)^2)^2 - (g*t1^2*((-1 + t1^2*(wa + wb)^2)*Cos[t*(wa + wb)] + 2*t1*(wa + wb)*Sin[t*(wa + wb)]))/(E^(t/t1)*(1 + t1^2*(wa + wb)^2)^2) and the integral is, eg. Integrate[%,{wa,-a,a}] By expanding the integrand into partial fractions I can partially understand what going on w.r.t. the trig containing terms - they comprise, something like, eg. Sin[t*(wa+wb)]/<a polynomial in wa>. I imagine that Mathematica then tries to shoehorn this expression into the Sine Integral, the complex terms arising from the manipulations/solutions of the polynomial in the denominator?? None of this gets me anywhere and in any case imaginary terms appear elsewhere in the integrated result. I have browsed MathGroup and tried a few thing but to no avail. Some of the things I have tried/are trying, are; (1) Loading Calculus`Limits` before doing the integral. (2) Using ComplexExpand[%,TargetFunctions->{Re,Im}] on the complex result of the Integrate command. (3) Using Assumptions with Integrate to tell it that all of the variables in the integrand are always +ve. (4) Running FullSimplify on the integrated result but I strongly doubt that it will remove all the imaginary terms. Essentially, the thing I need to tell Mathematica is: Do the Integral, feel free to use your knowledge of special functions etc. to make a more useful result, but *don't* introduce any complex arithmetic. How can I persuade it to do this? Thanks. Tom Crane. Ps. I'm using Mathematica 4.0 on Win98. -- Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill, Egham, Surrey, TW20 0EX, England. Email: T.Crane at rhbnc.ac.uk SPAN: 19.875 Fax: 01784 472794