MathGroup Archive 2008

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

Search the Archive

Re: Re: bug -- advice sought

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84776] Re: [mg84689] Re: bug -- advice sought
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 14 Jan 2008 03:44:17 -0500 (EST)

On 13 Jan 2008, at 14:56, T.Crane wrote:
>
>
> : 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?

Mathematica 6.0 and 5.2 give:

In[10]:= Element[z, Reals] && And @@ {Rx > 0, Rvt > 0, Dc > 0, w > 0}
Out[10]= Element[z, Reals] && Rx > 0 && Rvt > 0 && Dc > 0 && w > 0

I don't have any earlier version installed on any computer I still use 
but I would expect that the same thing would happen since And was last 
modified in version 3. On the other hand, according to the 
documentation, Reduce was seriously modified in version 5 so I am 
suprised by your report that the command does not work in version 5.0.

As for the output

Rx > 0 =E2=87=93 Rvt > 0 =E2=87=93 Dc > 0 =E2=87=93 w > 0

it simply means that the original condition (with Element[z,Reals]) 
reduces to this condition alone. This is, of course, the same as 
saying that the condition Element[z,Reals] is implied by the inequality.

>
>
> 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.


Your expressions can't be right as they are independent of y. I guess 
what you must have meant was
  q=Sqrt[(1 - x/Sqrt[x^2 + y^2])/2]
   etc. If you are willing to add assumptions on x and y you can make
  Mathematica return expressions, close to this

  p = Assuming[x > 0 && y >0, FullSimplify[
        Sin[(1/2)*ArcTan[x, y]], ComplexityFunction ->
          (Count[#1, ArcTan | Log, Infinity,
               Heads -> True] & )]]

1/(Sqrt[2]*(x^2 + y^2)^(1/4)*
       Sqrt[-(1/(x - Sqrt[x^2 + y^2]))])

FullSimplify[Sqrt[(1 - x/Sqrt[x^2 + y^2])/2] == p,
    {x > 0, y > 0}]
True



>  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?

You could try to use the same approach as above. The problem seems to 
be, however, that Simplify does not know enough transformations to get 
rid of ArcTan stuff while FullSimplify takes too long. One possibility 
is to use FullSimplify with a time constraint. Here is what I get:

In[1]:= 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);

In[2]:= igral = Integrate[igrand, {theta, 0, Pi/2},
        Assumptions -> {Rx > 0, Rvt > 0, w > 0, Dc > 0,
            theta >= 0}];

In[3]:= igralp = Simplify[ComplexExpand[Re[igral],
          TargetFunctions -> {Re, Im}],
        {Rx > 0, Rvt > 0, Dc > 0, w > 0}];

In[4]:= Quiet[Assuming[Rx > 0 && Rvt > 0 && Dc > 0 && w > 0,
      FullSimplify[igralp, ComplexityFunction ->
          (LeafCount[#1] + 100*Count[#1, ArcTan | ArcCot | Log, 
Infinity,
                   Heads -> True] & ), TimeConstraint -> 0.01]]]
Out[4]= (Pi*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*
       (24*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*Rvt^12 +
          108*Rx^2*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*
            Rvt^10 - 32*Dc^(5/2)*w^2*(w^2*Rx^4 + 4*Dc^2)^
              (1/4)*Rvt^8 + 195*Rx^4*w^4*
            (4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*Rvt^8 +
          180*Rx^6*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*
            Rvt^6 + 4*(Rvt^2 + Rx^2)^(5/2)*w^3*
            ((Rvt^2 + Rx^2)^2*w^2 - 12*Dc^2)*
            Sqrt[1 - (2*Dc)/Sqrt[w^2*Rx^4 + 4*Dc^2]]*Rvt^5 -
          8*Dc*(Rvt^2 + Rx^2)^(3/2)*w^2*
            (3*(Rvt^2 + Rx^2)^2*w^2 - 4*Dc^2)*
            Sqrt[(2*Dc)/Sqrt[w^2*Rx^4 + 4*Dc^2] + 1]*Rvt^5 +
          120*Dc^(5/2)*Rx^4*w^2*(w^2*Rx^4 + 4*Dc^2)^(1/4)*
            Rvt^4 + 90*Rx^8*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^
              (1/4)*Rvt^4 + 112*Dc^(5/2)*Rx^6*w^2*
            (w^2*Rx^4 + 4*Dc^2)^(1/4)*Rvt^2 +
          24*Rx^10*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)*
            Rvt^2 + 64*Dc^4*Rx^2*(4*Dc^4 + Rx^4*w^2*Dc^2)^
              (1/4)*Rvt^2 + 24*Dc^(5/2)*Rx^8*w^2*
            (w^2*Rx^4 + 4*Dc^2)^(1/4) + 48*Dc^4*Rx^4*
            (4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4) +
          3*Rx^12*w^4*(4*Dc^4 + Rx^4*w^2*Dc^2)^(1/4)))/
    (16*Rvt^5*(Rvt^2 + Rx^2)^(3/2)*
       Sqrt[w^2*Rx^4 + 4*Dc^2]*
       (4*Dc^2 + (Rvt^2 + Rx^2)^2*w^2)^3)


This is almost certianly not the simplest expression one could get but 
it seems not to contain the functions you wanted to get rid of.

Andrzej Kozlowski


  • Prev by Date: Re: Re: Creating a set from two other sets
  • Next by Date: Problem trying to Solve for 'theta' ... v6.01
  • Previous by thread: Re: bug -- advice sought
  • Next by thread: Re: Re: bug -- advice sought