MathGroup Archive 2008

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

Search the Archive

Re: Re: Re: bug -- advice sought

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84864] Re: [mg84810] Re: Re: bug -- advice sought
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 16 Jan 2008 23:09:22 -0500 (EST)
  • References: <fmf7cq$dct$1@smc.vnet.net> <200801150818.DAA11798@smc.vnet.net>

On 15 Jan 2008, at 08:18, UHAP023 at alpha1.rhbnc.ac.uk wrote:

> Thanks again for the followup.
>
> Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
>
> : 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
>
> Strange. On V5.0 I get;
>
> In[3]:=
> Element[z,Reals]&&And@@{Rx>0,Rvt>0,Dc>0,w>0} // InputForm
>
> Out[3]//InputForm=
> 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) \[Element]  
> Reals && Rx > 0 && Rvt > 0 && Dc > 0 && w > 0	

There is some confusion here since I had z undefined in my first input  
and output, which was meant to show that the syntax was correct.  
Actually your output also shows that the syntax is fine.


>
>
> : 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.
>
> and with Reduce[],
>
> In[4]:=
> Reduce[Element[z,Reals]&&And@@{Rx>0,Rvt>0,Dc>0,w>0},{Rx,Rvt,Dc,w}] // 
> InputForm
>
>> From In[4]:=
> Reduce::"nsmet" :This system cannot be solved with the methods  
> available to Reduce.
>
> Out[4]//InputForm=
> Reduce[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) \[Element]  
> Reals && Rx > 0 && Rvt > 0 && Dc > 0 && w > 0, {Rx, Rvt, Dc, w}]
>
>

This suggests that Reduce was changed between version 5.0 and 5.2  
although the documentation only mentions a change in version 5. But it  
is possible that while Reduce was not changed a function called by  
Reduce was, which would account for Reduce not working in version 5.0  
but working fine in 5.2.

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

> Agreed. I tried running the above FullSimplify on a 1.1GHz Athlon  
> machine for
> a couple of hours without result.  I would be interested to know how  
> long
> it took you and your machine's spec.

I run this on a 2 GHZ Mac Book and it took a very short time. So it  
must be due to improvements in Mathematica (I used v. 6) rather than  
hardware.

>
>
> I spent some timing experimenting with FullSimplify[TimeConstraint- 
> >value]
> on Mathematica 4.0 and came to the conclusion that its granularity was
> only 1 second and moreover that specifying values (>0 & <=1) were
> equivalent to specifying 1.  The Mathematica 4.0 documentation is
> a bit opaque on this issue.  What do you think?
>

Certainly in Mathematica 6 specifying TimeConstraint->0.01 makes the  
the code works fast while TimeConstraint->1 takes forever. As I  
already mentioned,  I can't check any versions earlier than 5.2.,  
which seems to be not significantly different from 6 in this respect.

Andrzej Kozlowski


  • Prev by Date: Re: problem with MLGetReal64Array
  • Next by Date: Re: Can you minimize a notebook window from a notebook in Version
  • Previous by thread: Re: Re: bug -- advice sought
  • Next by thread: Re: Avoid slow initialization of DynamicModule