Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. Log[17]/Log[2] -> Log2[17]
  2. Log[13]/Log[10] -> Log10[13]
  3. Log[99]/Log[11] -> Log[11, 99]
  4.  
  5. $PrePrint = # /. {
  6. Log[n_]/Log[2] :> Defer @ Log2[n],
  7. Log[n_]/Log[10] :> Defer @ Log10[n],
  8. Log[n_]/Log[b_] :> Defer @ Log[b, n]
  9. } &;
  10.  
  11. MakeBoxes[Log[n_]/Log[2], fmt_] := ToBoxes[Defer @ Log2[n], fmt]
  12. MakeBoxes[Log[n_]/Log[10], fmt_] := ToBoxes[Defer @ Log10[n], fmt]
  13. MakeBoxes[Log[n_]/Log[b_], fmt_] := ToBoxes[Defer @ Log[b, n], fmt]
  14.  
  15. Unprotect[Times];
  16.  
  17. Format[Log[n_]/Log[2]] := Defer @ Log2[n]
  18. Format[Log[n_]/Log[10]] := Defer @ Log10[n]
  19. Format[Log[n_]/Log[b_]] := Defer @ Log[b, n]
  20.  
  21. Protect[Times];
  22.  
  23. SetSystemOptions["SimplificationOptions" -> "AutosimplifyTwoArgumentLog" -> False];
  24.  
  25. logRule = Log[x_]/Log[b_] :> Switch[b, 2, Log2[x], 10, Log10[x], _, Log[b, x]];
  26.  
  27. {Log[17]/Log[2], Log[13]/Log[10], Log[99]/Log[11]} /. logRule
  28. {Log2[17], Log10[13], Log[11, 99]}
  29.  
  30. Expand[(Log[17] + Log[4])/Log[10]] /. logRule
  31. Log10[4] + Log10[17]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement