Re: Reduce in Mathematica 5 vs Mathematica 8

• To: mathgroup at smc.vnet.net
• Subject: [mg114918] Re: Reduce in Mathematica 5 vs Mathematica 8
• Date: Thu, 23 Dec 2010 03:51:12 -0500 (EST)
• References: <359276.84917.qm@web26102.mail.ukl.yahoo.com> <0143E267-BA40-4908-B473-F1DE4A84F5DB@mimuw.edu.pl>

```Andrzej Kozlowski wrote:
> On 22 Dec 2010, at 15:20, olfa mraihi wrote:
>
>> Thank you for the information about Reduce.
>> Below is an example that I've sent to mathematica mailing list this morning:
>> Thank you fr your help.
>>
>> --- En date de : Mer 22.12.10, olfa <olfa.mraihi at yahoo.fr> a écrit :
>>
>> De: olfa <olfa.mraihi at yahoo.fr>
>> Objet: Reduce in Mathematica 5 vs Mathematica 8
>> À: olfa.mraihi at yahoo.fr
>> Date: Mercredi 22 décembre 2010, 11h09
>>
>> Hi Mathematica Community,
>>
>> Knowing that Reduce has'nt been modified in Mathematica 8 why the same
>> system that I try to solve with Reduce gives result with Mathematica 5
>> but not with Mathematica 8?
>>
>> Reduce[-y + Log[Log[v]]/Log[2] == -yP + Log[Log[vP]]/Log[2] &&   yP ==
>> y + Floor[Log[x]/Log[2]], {yP, vP}, Backsubstitution -> True]
>>
>> Thank you very much.
>>
>
> I checked the answer that Mathematica 5.2. The solution that you get is this:
>
> Reduce[-y + Log[Log[v]]/Log[2] == -yP + Log[Log[vP]]/Log[2] && yP == y + Floor[Log[x]/Log[2]],
>   {yP, vP}, Backsubstitution -> True]
>
>
> (E^-Re[K\$335[1]]==0&&-Log[2] Im[Floor[Log[x]/Log[2]]]-\[Pi]<Im[Log[Log[v]]]<=\[Pi]-Im[Floor[Log[x]/Log[2]]] Log[2]&&yP==y+Floor[Log[x]/Log[2]]&&vP==v^2^Floor[Log[x]/Log[2]])||(E^Re[K\$335[1]]>0&&-E^Re[K\$335[1]] \[Pi]<=Sin[Im[K\$335[1]]]<E^Re[K\$335[1]] \[Pi]&&E^-Re[K\$335[1]]>0&&-Log[2] Im[Floor[Log[x]/Log[2]]]-\[Pi]<Im[Log[Log[v]]]<=\[Pi]-Im[Floor[Log[x]/Log[2]]] Log[2]&&yP==y+Floor[Log[x]/Log[2]]&&vP==v^2^Floor[Log[x]/Log[2]])||(E^Re[K\$335[1]]<0&&E^Re[K\$335[1]] \[Pi]<Sin[Im[K\$335[1]]]<=-E^Re[K\$335[1]] \[Pi]&&E^-Re[K\$335[1]]<0&&-Log[2] Im[Floor[Log[x]/Log[2]]]-\[Pi]<Im[Log[Log[v]]]<=\[Pi]-Im[Floor[Log[x]/Log[2]]] Log[2]&&yP==y+Floor[Log[x]/Log[2]]&&vP==v^2^Floor[Log[x]/Log[2]])
>
> It seems to me that the whole expression is complete nonsense. It contains lots of obviously nonsensical expressions such as:
>
> (E^(-Re[K\$335[1]]) == 0
>
> how can E to any power by 0? And what is the meaning of K\$335[1]?
>
> and what about inequalities involving complex numbers such as:
>
> -Log[2] Im[Floor[Log[x]/Log[2]]] - \[Pi] <
>  Im[Log[Log[v]]] <= \[Pi] - Im[Floor[Log[x]/Log[2]]] Log[2]
>
> How can an imaginary quantity Im[Log[Log[v]]] be smaller or greater than another imaginary quantity?
> As I wrote above,  whole thing is just a lot of nonsense and I don't think a lot of nonsense is a better answer than not giving any answer.
>
>
> In fact your equation problem requires doing this:
>
> Reduce[Log[Log[v]] == A, v]
>
> But Reduce cannot do this either in Mathematica 5.2 or Mathematica 8. The reason for that is that Reduce has to give a complete answer which it cannot do in this case. However, if you do not need a complete answer Solve can do this:
>
>  Solve[Log[Log[v]] == A, v]
>
> {{v -> E^E^A}}
>
> So this suggest that, if you do not need a complete solution, you can just use Solve in your equation to get:
>
> Solve[-y + Log[Log[v]]/Log[2] == -yP + Log[Log[vP]]/Log[2] && yP == y + Floor[Log[x]/Log[2]], {yP, vP}]
>
> {{yP -> Floor[Log[x]/Log[2]] + y, vP -> v^2^Floor[Log[x]/Log[2]]}}
>
> except that (and here there seems to be a bug in Mathematica 8) this works in Mathematica 7 but not in Mathematica 8.
>
> In Mathematica 8 we get:
>
>  Solve[-y + Log[Log[v]]/Log[2] == -yP + Log[Log[vP]]/Log[2] && yP == y + Floor[Log[x]/Log[2]], {yP, vP}]
>
>  During evaluation of In[1]:= Solve::nsmet:This system cannot be solved with the methods available to Solve.
>
> Solve[Log[Log[v]]/Log[2] - y == Log[Log[vP]]/Log[2] - yP && yP == Floor[Log[x]/Log[2]] + y, {yP, vP}]
>
> Why is that? Well, it seems that in Mathematica 8 Solve behaves rather like Reduce and attempts to give a "conditional" answer in such cases, which it can't even do this:
>
> Solve[Log[Log[vP]] == Floor[Log[x]/Log[2]], vP]
>
>  During evaluation of In[8]:= Solve::nsmet:This system cannot be solved with the methods available to Solve. >>
>
> Solve[Log[Log[vP]] == Floor[Log[x]/Log[2]], vP]
>
>
> This is easily dealt with by Solve in Mathematica 7. The only way to get around this in Mathematica 7 seems to me to be
>
> Solve[Log[Log[vP]] == Floor[Log[x]], vP, Method -> "Legacy"]
>
> {{vP -> E^E^Floor[Log[x]]}}
>
> which isn't really satisfactory. I am inclined to treat this as a bug, unless persuaded otherwise...
>
>
> Andrzej Kozlowski
>

Version 8 Solve (with the automatic method setting) does not use
the "legacy" Solve code whenever piecewise functions are present.
This is in order to prevent solutions like

In[1]:= Solve[Floor[x]==1, x, Method->"Legacy"]

(-1)
Out[1]= {{x -> (Floor    )[1]}}

The presence of Floor should not be a problem in your examples
though, since the Floor subexpressions do not contain the solve
variables. I will change the method choice heuristic for the next
version.

Here's another, not too satisfactory, workaround

In[1]:= Solve[Log[Log[v]]/Log[2] - y == Log[Log[vP]]/Log[2] - yP && yP
== Floor[Log[x]/Log[2]] + y /. Floor->floor, {yP, vP}] /. floor->Floor

Floor[Log[x]/Log[2]]
Log[x]          2
Out[1]= {{yP -> y + Floor[------], vP -> v                     }}
Log[2]

Best regards,