0
$\begingroup$

https://www.wolframalpha.com/input/?i=%28a+and+b+and+c%29+or+%28not+a+and+not+b+and+not+c%29+or+%28not+a+and+b+and+not+c%29+or+%28a+and+not+b+and+not+c%29

How do you plot Venn Diagramm shown in the VA Link with Mathematica for a given boolean formula?

$\endgroup$
  • 1
    $\begingroup$ seen new in 12 / venn-diagram? $\endgroup$ – kglr Feb 20 at 21:28
  • $\begingroup$ Why not insert all the needed information and the diagram in the question? $\endgroup$ – yarchik Feb 20 at 22:35
3
$\begingroup$

Construct a function using the input boolean expression:

ClearAll[a, b, c, boolfunc]

boolfunc = Function[{a, b, c}, 
  (a && b && c) || (! a && ! b && ! c) || (! a && b && ! c) || (a && ! b && ! c)];

Use boolfunc to create a boolean region using three disks as input:

a = Disk[{0, .5}];
b = Disk[{-0.5, -.5}];
c = Disk[{0.5, -.5}];

BoundaryDiscretizeRegion[BooleanRegion[boolfunc, {a, b, c}],
 MeshCellStyle -> {2 -> RGBColor[1, 0.932, 0.821]}, 
 Epilog -> {EdgeForm[{Thin, Gray}], FaceForm[], {a, b, c}, 
   MapThread[Text, 
     {Style[#, 16, Gray] & /@ {"a", "b", "c"},
     {{0, 1.25}, {-1.25, -.5}, {1.25, -.5}}}]}]

enter image description here

Compare with the picture WolframAlpha gives:

WolframAlpha["(a&&b&&c)||(!a&&!b&&!c)||(!a&&b&&!c)||(a&&!b&&!c)", 
  {"VennDiagram", 1}, "Content"}]

enter image description here

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.