Re: bug -- advice sought
- To: mathgroup at smc.vnet.net
- Subject: [mg84568] Re: bug -- advice sought
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Thu, 3 Jan 2008 20:36:05 -0500 (EST)
- References: <7145136.1199359097519.JavaMail.root@m08>
- Reply-to: drmajorbob at bigfoot.com
Maybe I'm missing something, but consider the following steps: z = 2*Sqrt[2]*Rvt^5*(Rvt^2 + Rx^2)^(3/2)* w^2*(Sqrt[2*Dc - I*Rx^2*w]*(2*Dc - I*(Rvt^2 + Rx^2)*w)^3 + Sqrt[2*Dc + I*Rx^2*w]*(2*Dc + I*(Rvt^2 + Rx^2)*w)^3) 2 Sqrt[2] Rvt^5 (Rvt^2 + Rx^2)^( 3/2) w^2 (Sqrt[ 2 Dc - \[ImaginaryI] Rx^2 w] (2 Dc - \[ImaginaryI] (Rvt^2 + Rx^2) w)^3 + Sqrt[2 Dc + \[ImaginaryI] Rx^2 w] (2 Dc + \[ImaginaryI] (Rvt^2 + Rx^2) w)^3) z2 = z // ExpandAll // Simplify 2 Sqrt[2] Rvt^5 (Rvt^2 + Rx^2)^( 3/2) w^2 (-12 \[ImaginaryI] Dc^2 (Rvt^2 + Rx^2) w (Sqrt[ 2 Dc - \[ImaginaryI] Rx^2 w] - Sqrt[ 2 Dc + \[ImaginaryI] Rx^2 w]) + \[ImaginaryI] (Rvt^2 + Rx^2)^3 w^3 (Sqrt[2 Dc - \[ImaginaryI] Rx^2 w] - Sqrt[ 2 Dc + \[ImaginaryI] Rx^2 w]) + 8 Dc^3 (Sqrt[2 Dc - \[ImaginaryI] Rx^2 w] + Sqrt[ 2 Dc + \[ImaginaryI] Rx^2 w]) - 6 Dc (Rvt^2 + Rx^2)^2 w^2 (Sqrt[2 Dc - \[ImaginaryI] Rx^2 w] + Sqrt[2 Dc + \[ImaginaryI] Rx^2 w])) z3 = z2 /. {Sqrt[2 Dc - \[ImaginaryI] Rx^2 w] -> u, Sqrt[2 Dc + \[ImaginaryI] Rx^2 w] -> v} 2 Sqrt[2] Rvt^5 (Rvt^2 + Rx^2)^( 3/2) w^2 (8 Dc^3 (u + v) - 12 \[ImaginaryI] Dc^2 (Rvt^2 + Rx^2) (u - v) w - 6 Dc (Rvt^2 + Rx^2)^2 (u + v) w^2 + \[ImaginaryI] (Rvt^2 + Rx^2)^3 (u - v) w^3) z4 = z3 /. {u + v -> sum, u - v -> diff} 2 Sqrt[2] Rvt^5 (Rvt^2 + Rx^2)^( 3/2) w^2 (8 Dc^3 sum - 12 \[ImaginaryI] Dc^2 diff (Rvt^2 + Rx^2) w - 6 Dc (Rvt^2 + Rx^2)^2 sum w^2 + \[ImaginaryI] diff (Rvt^2 + Rx^2)^3 w^3) z5 = Collect[z4 // ExpandAll, {sum, diff}, Simplify] 2 \[ImaginaryI] Sqrt[2] diff Rvt^5 (Rvt^2 + Rx^2)^(5/2) w^3 (-12 Dc^2 + (Rvt^2 + Rx^2)^2 w^2) - 4 Sqrt[2] Dc Rvt^5 (Rvt^2 + Rx^2)^(3/2) sum w^2 (-4 Dc^2 + 3 (Rvt^2 + Rx^2)^2 w^2) Now, it's easy to convince myself that u+v and u-v are real, if one chooses an appropriate branch cut for Sqrt. And then z5 is real <==> u == v. And a branch cut might be chosen to make THAT true... but is it the same branch cut as the one that makes u+v real? Bobby On Thu, 03 Jan 2008 04:35:21 -0600, <UHAP023 at alpha1.rhbnc.ac.uk> wrote: > Dear All, > A couple of queries; > > (1) Regarding the following expression, > > z=2*Sqrt[2]*Rvt^5*(Rvt^2 + Rx^2)^(3/2)*w^2* > (Sqrt[2*Dc - I*Rx^2*w]*(2*Dc - I*(Rvt^2 + Rx^2)*w)^3 + > Sqrt[2*Dc + I*Rx^2*w]*(2*Dc + I*(Rvt^2 + Rx^2)*w)^3) > > all the variables are of Real type and are +ve. I do the following > FullSimplify[], > > z = FullSimplify[ > z, {Rx \[Element] Reals, Rvt \[Element] Reals, Dc \[Element] Reals , > w \[Element] Reals, Rx > 0, Rvt > 0, Dc > 0, w > 0}] > > and get an unchanged result. Now I believe that this expression > should *always* produce a real result for real, +ve parameter values. > A simple but obviously non-rigorous test is to substitute arbitrary > real,+ve values for the parameters and observe the numeric result, > eg., > > Rx = Random[]; Rvt = Random[]; w = Random[]; Dc = Random[]; z > > The result is indeed always real (ie. Im[z]==0). Given that > FullSimplify[] tries to return the simplest result rather than > eliminate complex expressions as I want, I tried doing, > > FullSimplify[z, {Rx \[Element] Reals, Rvt \[Element] Reals, > Dc \[Element] Reals, w \[Element] Reals, Rx > 0, Rvt > 0, Dc > 0,= > w > 0}, ComplexityFunction -> (Count[{#1}, _Complex , \[Infinity]]= = > &)] > > which I hoped would do what I want. Unfortunately it returns a more > complicated result (fair enough) but which has the same number of I's > as the input expression (not OK). What am I doing wrong here? Is > there a way to do this? > > ========================= ========================= ========================= ===== > > (2) The above query was precipitated indirectly by the following > strangeness. I am integrating the following integrand, > > igrand=(Dc*Rx^2*Cos[theta]^2)/((4*Dc^2 + Rx^4*w^2*Cos[theta]^4)* > (Rvt^2 + Rx^2*Sin[theta]^2)^3) > > Again the parameters are all of Real type and +ve. Moreover the > expression only contains a fraction, sums and products. The integral > below is definite and both Cos[] and Sin[] are +ve over the > integration limits, so the area under the graph should also be Real > and +ve. > > igral = Integrate[igrand, {theta, 0, Pi/2}, > Assumptions -> {Rx \[Element] Reals, Rvt \[Element] Reals, > w \[Element] Reals, Dc \[Element] Reals, theta \[Element] Real= s, > Rx > 0, Rvt > 0, w > 0, Dc > 0, theta >= 0}] > > However the integral contains many complex terms which is > understandable AIUI because Integrate[] tries many transforms/pattern > matches to do the integration -- some of which will produce a complex > result. The thing that puzzles me is that the integration result > contains lots of terms such as 'Sign[Rvt]^2'. My point is that > Integrate[] has been explicitly told in its Assumptions argument that > Rvt in this case is Real and +ve, so why does it do this? Is this a > bug? Admittedly a, > > Simplify[igral, {Rx \[Element] Reals, Rvt \[Element] Reals, > w \[Element] Reals, Dc \[Element] Reals, Rx > 0, Rvt > 0, w > 0, D= c = > > 0}] > > will remove terms like 'Sign[Rvt]^2' but I still end up with a complex= > and unwieldy expression which is much larger that the integrand. > > Any suggestions? > > Many thanks > Tom Crane > > Ps. I'm using Mathematica 4.0 and the From: field in the message heade= r = > is > invalid. It is just a spam-trap. > -- = DrMajorBob at bigfoot.com