MathGroup Archive 1998

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

Search the Archive

Re: Integrate Bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13190] Re: [mg13123] Integrate Bug?
  • From: "Jrgen Tischer" <jtischer at col2.telecom.com.co>
  • Date: Mon, 13 Jul 1998 07:42:40 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Ed,

I took your equations and deleted everything which was literally equal.
I ended up with

Log[2 + b*Nt*u*W - Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W]

against

Log[-2 - b*Nt*u*W + Sqrt[b^2*Nt^2*(u^2 - 4*w)]*W].

I think now everything is clear, isn't it?

(In case you don't agree look at the following:

In[1]:= f=Log[1-x]                                    
Out[1]= Log[1-x]

In[2]:= fp=D[f,x]                                       
Out[2]= -(1 /(1 - x))

In[3]:= f1=Integrate[fp,x]                         
Out[3]= Log[-1+x ]

In[4]:= f/.x->.3                                          
Out[4]= -0.356675

In[5]:= f1/.x->.3
                                       
Out[5]= -0.356675+3.14159 I )

Jrgen

-----Original Message-----
From: Ed Hall <teh1m at virginia.edu>
To: mathgroup at smc.vnet.net
Subject: [mg13190] [mg13123] Integrate Bug?


>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]==3D0
>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: help with trig(?) calculation
  • Next by Date: Problems with numerical precision
  • Previous by thread: Re: Integrate Bug?
  • Next by thread: Re: Integrate Bug?