Re: bug -- advice sought
- To: mathgroup at smc.vnet.net
- Subject: [mg84689] Re: bug -- advice sought
- From: UHAP023 at alpha1.rhbnc.ac.uk
- Date: Thu, 10 Jan 2008 02:23:43 -0500 (EST)
- Organization: Low Temperature Physics, RHUL
- References: <200801031035.FAA15853@smc.vnet.net> <flk1sk$bll$1@smc.vnet.net>
Many thanks Andrzej and all who followed up my original query/thread. Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: : On 3 Jan 2008, at 19:35, UHAP023 at alpha1.rhbnc.ac.uk wrote: [cut] : Here is one way to do this. Let : z = 2*Sqrt[2]*Rvt^5*(Rvt^2 + Rx^2)^(3/2)*w^2* : (Sqrt[I*w*Rx^2 + 2*Dc]* : (2*Dc + I*(Rvt^2 + Rx^2)*w)^3 + : (2*Dc - I*(Rvt^2 + Rx^2)*w)^3* : Sqrt[2*Dc - I*Rx^2*w]) : First, let's show that your expression is always real under the : conditions you state: : Reduce[Element[z, Reals] && : And @@ {Rx > 0, Rvt > 0, Dc > 0, w > 0}, : {Rx, Rvt, Dc, w, Rx, Rvt, Dc, w}] : Rx > 0 && Rvt > 0 && Dc > 0 && w > 0 : This may look strange but it actually says that z is indeed real under : the stated conditions. So now let's try to find an expression for z : not involving I: Yes this does look strange -- is the '&& And @@' definitely correct syntax? I tried this command under Mathematica 4.0 and 5.0 and both reject it. I presume you are using a later version? : p = FullSimplify[ComplexExpand[Re[z], : TargetFunctions -> {Re, Im}], : {Rx > 0, Rvt > 0, Dc > 0, w > 0}] : 4*Sqrt[2]*Rvt^5*(Rvt^2 + Rx^2)^(3/2)*w^2* : (w^2*Rx^4 + 4*Dc^2)^(1/4)* : (2*Dc*(4*Dc^2 - 3*(Rvt^2 + Rx^2)^2*w^2)* : Cos[(1/2)*ArcCot[(2*Dc)/(Rx^2*w)]] + : (Rvt^2 + Rx^2)*w*((Rvt^2 + Rx^2)^2*w^2 - 12*Dc^2)* : Sin[(1/2)*ArcCot[(2*Dc)/(Rx^2*w)]]) : As you can see, there are no I's. Let's confirm that this is indeed : equal to z under your conditions: Agreed. This is very useful but I would like to manipulate it a little further. BTW Mathematica 4.0 gives p in terms of Sin[(1/2)*ArcTan[x,y]] & Cos[(1/2)*ArcTan[x,y]] rather than your Sin[(1/2)*ArcCot[x/y]] & Cos[(1/2)*ArcCot[x/y]] which is a little less clean. Now Sin[(1/2)*ArcTan[x,y]] and Cos[(1/2)*ArcTan[x,y]] can be written as (x*Sqrt[1 - 1/Sqrt[1 + x^2]])/(Sqrt[2]*Sqrt[x^2]) and (Sqrt[1 + 1/Sqrt[1 + x^2]]/Sqrt[2]) respectively, taking into account the signs of the x & y arguments and the 'quadrant' they appear in. For the above expression z this can easily be done with ReplaceAll but not for a more complicated expression like the result of my second question, which (for brevity here) is produced by; 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) igral = Integrate[igrand, {theta, 0, Pi/2}, Assumptions -> {Rx > 0, Rvt > 0, w > 0, Dc > 0, theta >= 0}] igral=Simplify[igral, {Rx > 0, Rvt > 0, w > 0, Dc > 0}] igralp = Simplify[ComplexExpand[Re[igral], TargetFunctions -> {Re, Im}], {Rx > 0, Rvt > 0, Dc > 0, w > 0}] So my question is; Is there any 'trick' along the lines of your p expression formula ComplexExpand[] to get Mathematica to replace expressions of the form SinorCos[aconstant*ArcTanorArcCot[stuff]] and similar with expressions like I've given above for the aconstant==1/2 case? Many thanks Tom Crane Ps. The From: field in the message header is invalid. It is just a spam-trap. CCed and posted. -- Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill, Egham, Surrey, TW20 0EX, England. Email: T.Crane at rhul dot ac dot uk Fax: +44 (0) 1784 472794
- References:
- Complex elimination and possible Integrate[] bug -- advice sought
- From: UHAP023@alpha1.rhbnc.ac.uk
- Complex elimination and possible Integrate[] bug -- advice sought