Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Integrate Bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13123] Integrate Bug?
  • From: Ed Hall <teh1m at virginia.edu>
  • Date: Tue, 7 Jul 1998 03:44:26 -0400
  • Organization: University of Virginia
  • Sender: owner-wri-mathgroup at wolfram.com

Folks,

The following integration problem appears to be a bug in Mathematica's
Integrate function and Wolfram's technical support has been unable to
help so far. I was hoping someone reading this newsgroup might be able
to come up with a solution.

I can create the expression below  (from the Peng-Robinson equation of
state)  which is real, differentiate  w.r.t the variable W, followed by
indefinite  integration w.r.t. to W to  get a complex result rather
than the original real expression. I've tried adding Im[W]==0
assumption to the Integrate command  w/o success. 

Composing the expression to be differentiated.

In[5]:= V = 1/W; d = Sqrt[u^2*Nt^2*b^2 - 4*w*b^2*Nt^2]; F = -(Nt*Log[(V
- Nt*b)/V]) + (a*Nt^2*Log[(2*V + u*Nt*b - d)/ (2*V + u*Nt*b +
d)])/(R*T*d)

Out[6]= (a*Nt^2*Log[(b*Nt*u - Sqrt[b^2*Nt^2*u^2 - 4*b^2*Nt^2*w] + 2/W)/
       (b*Nt*u + Sqrt[b^2*Nt^2*u^2 - 4*b^2*Nt^2*w] + 2/W)])/
   (R*T*Sqrt[b^2*Nt^2*u^2 - 4*b^2*Nt^2*w]) - Nt*Log[(-b*Nt + 1/W)*W]

In[7]:= F = FullSimplify[F]

Out[7]= 1/(R*T)*Nt*(-R*T*Log[1 - b*Nt*W] + (a*Nt*Log[(2 + b*Nt*u*W -
            Sqrt[b^2*Nt^2* (u^2 - 4*w)]*W)/ (2 + b*Nt*u*W +
Sqrt[b^2*Nt^2*
            (u^2 - 4*w)]*W)])/ Sqrt[b^2*Nt^2*(u^2 - 4*w)])


Taking partial derivative  w.r.t. W


In[8]:= test = D[F, W]

Out[8]= 1/(R*T)*Nt*((b*Nt*R*T)/(1 - b*Nt*W) + 
     (a*Nt*(2 + b*Nt*u*W + Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W)*
        (-(((b*Nt*u + Sqrt[b^2*Nt^2*(u^2 - 4*w)])*
               (2 + b*Nt*u*W - Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W))/
             (2 + b*Nt*u*W + Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W)^2) + 
             (b*Nt*u - Sqrt[b^2*Nt^2*(u^2 - 4*w)])/
           (2 + b*Nt*u*W + Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W)))/
      (Sqrt[b^2*Nt^2*(u^2 - 4*w)]* 
      (2 + b*Nt*u*W - Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W)))
 

Performing indefinite integration on result of differentiation.


In[9]:= F1 = FullSimplify[Integrate[test, W]]

Out[9]= 1/(R*T)*Nt*(-R*T*Log[-1 + b*Nt*W] + (a*Nt*(Log[-2 - b*Nt*u*W + 
            Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W] - 
            Log[2 + b*Nt*u*W + Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W]))/
            Sqrt[b^2*Nt^2*(u^2 - 4*w)]) 


Substituting numeric values into the original expression F (before 
differentiation and integration).


In[10]:= N[F /. {b -> 1, Nt -> 2, u -> 2, w -> -1, W -> 0.25, a -> 1, 
    R -> 1, T -> 1}]
 
Out[10]= 0.662394


Substituting numeric values into the expression F1 after differentiation
and  integration.


In[11]:= N[F1 /. {b -> 1, Nt -> 2, u -> 2, w -> -1, W -> 0.25, a -> 1, 
    R -> 1, T -> 1}]

Out[11]= 0.662394 - 4.06174 I


The result F1 of the integration is complex whereas the original 
expression F before differention is real.  How can I insure F1 will be 
real and equal to F?


Thanks in advance,
Ed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Ed Hall                                      Research Computing Support
 edhall at virginia.edu            Information Technology and Communication
 804-924-0620                                    The University Virginia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  • Prev by Date: Re: Non-commutative algebra
  • Next by Date: 2-D Chebyshev Polynomial Regression
  • Previous by thread: Re: Integer declaration
  • Next by thread: Re: Integrate Bug?