SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. In[1]:= 2^3^2^3^5^8 < 3^2^2^7^6^7
  2. During evaluation of In[1]:= General::ovfl: Overflow occurred in computation. >>
  3. During evaluation of In[1]:= General::ovfl: Overflow occurred in computation. >>
  4.  
  5. Out[1]= Indeterminate < Indeterminate
  6.      
  7. In[2]:= Log[Log[2]] + Log[3] 2^3^5^8 < Log[Log[3]] + Log[2] 2^7^6^7  
  8. During evaluation of In[2]:= General::ovfl: Overflow occurred in computation. >>
  9. During evaluation of In[2]:= General::ovfl: Overflow occurred in computation. >>
  10.  
  11. Out[2]= Overflow[] < Overflow[]
  12.      
  13. In[3]:= WolframAlpha["2^3^2^3^5^8 < 3^2^2^7^6^7", "MathematicaForms"][[2, 1]]
  14. Out[3]= True
  15.  
  16. In[4]:= WolframAlpha["2^2^5^2^7^4^9^3^7^6^9^9^9^9^3^2 < 3^3^6^3^9^4^2^3^2^2^2^2^2^3^3^3", "MathematicaForms"][[2, 1]]
  17. Out[4]= True
  18.      
  19. In[5]:= WolframAlpha["4^6^8^8^9 < 3^2^3^3^3", "MathematicaForms"]
  20. Out[5]= {}
  21.      
  22. In[6]:= WolframAlpha["3^3^3^3^3 < 4^4^3^3^3", "MathematicaForms"][[2, 1]]
  23. Out[6]= False
  24.      
  25. ClearAll[symbolicConvert];
  26. SetAttributes[symbolicConvert, {HoldAll, Listable}];
  27. symbolicConvert[num_] := Unevaluated[num] /. Power -> power
  28.      
  29. ClearAll[log];
  30. log[power[base_, exp_]] := exp * log[base];
  31.  
  32. log[HoldPattern[Times[args__]]] := Total@Map[log, {args}];
  33.  
  34. log[(main : (_log*_power)) + rest_] :=  log[main] + log[1 + rest/main];
  35.  
  36. log[main_ + rest : log[1 + _]] := log[main] + log[1 + rest/main];
  37.      
  38. start = symbolicConvert[2^3^2^3^5^8]
  39.  
  40. (* power[2, power[3, power[2, power[3, power[5, 8]]]]]  *)
  41.      
  42. NestList[log, start,4]
  43.      
  44. ClearAll[getNestingLength];
  45. getNestingLength[expr_power] :=
  46.    Length[{expr /. power -> Sequence}] - 1;
  47.      
  48. ClearAll[getMain];
  49. getMain[main_ + log[1 + _]] := main;
  50. getMain[x_ /; FreeQ[x, power]] := x;
  51.      
  52. ClearAll[prep];
  53. SetAttributes[prep, HoldAll];
  54. prep[fst_Power, sec_Power] :=
  55.   With[{nest = Max[getNestingLength /@ #]},
  56.      Map[Nest[log, #, nest] &, #]] &@symbolicConvert[{fst, sec}];
  57.      
  58. prep[2^3^2^3^5^8, 3^2^2^7^6^7]
  59.      
  60. ClearAll[less];
  61. less[fst_, sec_] /; And @@ Map[
  62.           MatchQ[#, (_ + log[1 + _]) | (x_ /; FreeQ[x, power])] &,
  63.           {fst, sec}] && getMain[fst] =!= getMain[sec] :=
  64.    getMain[fst] < getMain[sec] /. log -> (If[# <= 0, 0, Log[#]] &);
  65.  
  66. less[fst : (main_ + log[1 + fr_/rmain_]), sec : (main_ + log[1 + sr_/rmain_])] :=
  67.    less[rmain + fr, rmain + sr];
  68.  
  69. less[a_log + b_/c_power, a_log + d_/c_power] := less[b, d];
  70.      
  71. less @@ prep[2^3^2^3^5^8, 3^2^2^7^6^7]
  72.  
  73. (* True *)
  74.  
  75. less @@ prep[10^3^4^5, 3^3^4^5]
  76.  
  77. (* False *)
  78.  
  79. less @@ prep[2^2^5^2^7^4^9^3^7^6^9^9^9^9^3^2, 3^3^6^3^9^4^2^3^2^2^2^2^2^3^3^3]
  80.  
  81. (* True *)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top