Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Mathematica gives complex result for real integral' topicStudent Support Forum > General > "Mathematica gives complex result for real integral"

Help | Reply To Topic
Author Comment/Response
William Golz
10/10/99 7:12pm

Synopsis: 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<1); note that t is simply a parameter in this integration. The functions consist of real constants, exponential functions(with real exponents), an sign and cosine functions. I have simplified the function and integrated it by parts myself, and there is NO IMAGINARY COMPONENT in the result, yet Mathematica returns one every time, even when it is of the form f(t)=(a+0i)g(t).

To see this question, you will need to copy the code into Mathematica 3.0 and execute it (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\)\)\)

This can only be an glitch, since the correct result has no imaginary component and none should result from the numerical routines. There may be some artificial way to eliminate the imaginary component, such as usinf Chop[expr] on the final result, after a value for t is given, or imposing an assumption such as Im[expr]==0. However, this only provides A RESULT, based upon an incorrect initial evaluation, which indicates that there is a flaw in the algorithms used by Integrate[expr].

The evaluation of the integral is also quite slow, even for n=2,although I have simplified the expression as much as possible, and will need to evaluate a latge number of terms.




URL: ,
Help | Reply To Topic