Search code examples
mathgraphicswolfram-mathematica

Generating topological space diagram in Mathematica


I have mathematica code to check whether a collection of sets satisfies the definition of a topology, I would now like to programmatically generate diagrams like these: topological spaces

How can this be done?


Solution

  • I'm not familiar with your problem but to create diagrams from primitives, that look kind of like the ones you have pasted, you can do this:

    start with the "base" case --

    base = {Circle[{-0.4, 0.4}, 0.1], Disk[{0, .125}, 0.05], 
       Text[Style["1", 24], {0, -0.1}],
       Disk[{0.5, .125}, 0.05], Text[Style["2", 24], {0.5, -0.1}], 
       Disk[{1., .125}, 0.05], Text[Style["3", 24], {1., -0.1}], 
       Circle[{.5, 0}, {.9, .5}]};
    
    Graphics[{base}, ImageSize -> 220]
    

    enter image description here

    From here just add elipses to the base case:

    Graphics[{base, Circle[{0, 0}, {.15, .3}]}, ImageSize -> 220]
    

    enter image description here

    Graphics[{base, Circle[{0, 0}, {.15, .3}], 
      Circle[{0.5, 0}, {.15, .3}], Circle[{0.25, 0}, {.58, .38}]}, 
     ImageSize -> 220]
    

    enter image description here

    Graphics[{base, Circle[{0.5, 0}, {.15, .3}], 
      Circle[{0.25, 0}, {.58, .38}], Circle[{0.75, 0}, {.58, .38}]}, 
     ImageSize -> 220]
    

    enter image description here

    Graphics[{base, Circle[{0.5, 0}, {.15, .3}], 
      Circle[{1, 0}, {.15, .3}], Red, AbsoluteThickness[6], 
      Line[{{-0.4, -0.5}, {1.4, 0.55}}], 
      Line[{{-0.4, 0.55}, {1.4, -0.5}}]}, ImageSize -> 220]
    

    enter image description here

    Graphics[{base, Circle[{0.25, 0}, {.58, .38}], 
      Circle[{0.75, 0}, {.58, .38}], Red, AbsoluteThickness[6], 
      Line[{{-0.4, -0.5}, {1.4, 0.55}}], 
      Line[{{-0.4, 0.55}, {1.4, -0.5}}]}, ImageSize -> 220]
    

    enter image description here

    Note that I set Frame->True while tweaking these so I could see the coordinates.