MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Oh, those complex values!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72127] RE: [mg72068] Oh, those complex values!!!
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 13 Dec 2006 06:39:16 -0500 (EST)

Aaron,

I would much prefer to write your f definition as follows...

f[a_, b_, c_, d_][x_] = x Log[a + b x + Sqrt[c + 2d x + x^2]];

If you do an indefinite integration you must always remember that the answer
is the returned value plus a constant. That constant could be a complex
number that undoes the imaginary number you get in your result. Also the
returned result contains multivalued functions and this complicates the
picture more.

A general definite integral seems to take too long, but if you integrate
with specific values of a, b, c, d you can obtain exact real results in
reasonable time.

Integrate[f[2, 2, 10, 1][x], {x, 0, 1}]
% // N

NIntegrate[f[2, 2, 10, 1][x], {x, 0, 1}]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: aaronfude at gmail.com [mailto:aaronfude at gmail.com]


Integrating a real function, getting complex values again. How to get
the correct answer here? How to systematically avoid this pitfall?

f=x Log[a+b x+Sqrt[c+2d x+x^2]];
t = Assuming[c>d^2&&a>0&&b>0,Integrate[f, x]];
u=t/.a\[Rule]2/.b\[Rule]2/.c\[Rule]10/.d\[Rule]1;

N[u/.x\[Rule]1-u/.x\[Rule]0]
9.50705\[InvisibleSpace]-29.7626 \[ImaginaryI]

NIntegrate[f/.a\[Rule]2/.b\[Rule]2/.c\[Rule]10/.d\[Rule]1, {x, 0, 1}]
0.954442

Many thanks in advance!

Aaron Fude



  • Prev by Date: Re: Function of several variables
  • Next by Date: Re: Custom distance function
  • Previous by thread: Oh, those complex values!!!
  • Next by thread: Re: Oh, those complex values!!!