Created
November 15, 2021 02:44
-
-
Save lucainnocenti/0e41ef50fe3764b41e338179f621d860 to your computer and use it in GitHub Desktop.
Two-dimensional visualisation of Shannon entropy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShannonEntropy[probs_] := -Total[# * Log @ #] & @ DeleteCases[probs, _?PossibleZeroQ]; | |
par[t_, s_] = {1, 0, 0} + t / Sqrt@2 {-1, 1, 0} + s/Sqrt[3/2] {-1/2, -1/2, 1} // Simplify; | |
par[pars_List] := par @@ pars; | |
ContourPlot[ | |
ShannonEntropy@par[t, s], {t, 0, Sqrt@2}, {s, 0, Sqrt[3/2]}, | |
PlotRange -> All, | |
ColorFunction -> "TemperatureMap", PlotRangePadding -> None, | |
Contours -> 10, | |
FrameStyle -> Directive[Large, Black, FontFamily -> "Latin Modern Math"], | |
FrameLabel -> (MaTeX[#, Magnification -> 2] & /@ {"t", "s"}), | |
AspectRatio -> Sqrt[3/2]/Sqrt[2] | |
] ~ Show ~ Graphics[{[email protected], Purple, | |
Circle[{1/Sqrt@2, 1/Sqrt@6}, 0.4] | |
} | |
] |
Author
lucainnocenti
commented
Nov 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment