Synopsis of the problem:
I get a complex result of the form f(t)=(a+bi)g(t) when evaluating a
real integrand F(x,t)*phi(x) over the interval {x:0<x<L). All of the
variables have been properly declared as real and the functions have
been declared as real for real arguments (using the package "ReIm").
To see the problem more clearly, the code can be copied into Mathematica
(3 or 4) and executed. (The Traditional or Standard Forms will not paste
into a text document such as this)
When evaluating the integral
\!\(\[Integral]\_0\%\[ScriptL]\( simpF\[CurlyPhi]\_n\)
\[DifferentialD]x\)
over the interval (0,ScriptL) where ScriptL=1. The
integrand
\!\(simpF\[CurlyPhi]\_n\ is, for n=1, given by
\!\(TraditionalForm
\`\(-\(1\/6\)\)\ \[ExponentialE]\^\(\(\(-3\)\
\[Tau]\)/2\)\
\((\((3 + 2\ \[Pi]\^2)\)\ \(cos(\[Pi]\ x)\) -
6\ \[ExponentialE]\^\(x/2\) + 3)\)\
\((cos(3.66558239083868908`\ x) +
sin(3.66558239083868908`\ x))\)\)
and for n=2,
\!\(TraditionalForm
\`\(-\(1\/6\)\)\ \[ExponentialE]\^\(\(\(-3\)\
\[Tau]\)/2\)\
\((\((3 + 2\ \[Pi]\^2)\)\ \(cos(\[Pi]\ x)\) -
6\ \[ExponentialE]\^\(x/2\) + 3)\)\
\((cos(6.58302641111680308`\ x) +
sin(6.58302641111680308`\ x))\)\)
I get the result for n=1,2, respectively
\!\(TraditionalForm
\`\((\(-2.34710341268466837`\) + 0.`\ \[ImaginaryI])\)\
\[ExponentialE]\^\(\(\(-3\)\ \[Tau]\)/2\)\)
\!\(TraditionalForm
\`2\[InvisibleSpace]'' ''\[InvisibleSpace]\(\((
\(-1.26446964467229783`\) + 0.`\ \[ImaginaryI])\)\
\[ExponentialE]\^\(\(\(-3\)\ \[Tau]\)/2\)\)\)
For simple functions F, the product F*phi can be integrated by parts,
where the result contains no potential for complex coefficients when the
variables are real valued. However, evaluating an identical integrand in
Mathematica will give the result f(t)=(a+0.i)g(t). There does not seem
to be any way to avert this, either by defining the variables to be real
and the functions to be real valued (for real arguments).
The evaluation of the integral is also quite slow, even for n=2, even
when the expression is simplified as much as possible, and the final
program will need to evaluate a larger number of terms.
Thanks in advance, Bill