[PYTHON] Mathematics memorandum to keep up with the field # 2

What is a set?

We will continue to summarize the set in Part 2.

Set type

It seems that the following are typical ones (is this all?).

--Subset

#Subset A is contained in the large set U
>>> U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
>>> A = {2, 3, 9, 10}
>>> A <= U
True

--Complementary set (what was played from the subset?) Obtained by the difference set described later. --Intersection

#Intersection of two sets
>>> U = {1, 2, 6, 10}
>>> A = {7, 3, 6, 9}
>>> U & A
{6}
>>> 

--Union

#Union sum of sets
>>> U = {1, 2, 6, 10}
>>> A = {7, 3, 6, 9}
>>> U | A
{1, 2, 3, 6, 7, 9, 10}
#Same element counts as one

--Complement

#Complement Subtract common elements from one set
>>> U = {1, 2, 6, 10}
>>> A = {7, 3, 6, 9}
>>> U - A
{1, 2, 10}

--Target difference

#Remove common elements from two sets of symmetric differences
>>> U = {1, 2, 6, 10}
>>> A = {7, 3, 6, 9}
>>> U ^ A
{1, 2, 3, 7, 9, 10}

--Empty set

#There are no result elements of the empty set operation
>>> U = {1, 2, 3}
>>> A = {4, 5, 6}
>>> U & A
set()

Grouping the above sets under clear conditions is called __set operation. __

Recommended Posts

Mathematics memorandum to keep up with the field # 4
Mathematics memorandum to keep up with the field # 2
Mathematics memorandum to keep up with the field # 3
Memorandum (Add name only to people with the same surname in the list)
[Python] Round up with just the operator
[Django] I made a field to enter the date with 4 digit numbers
Match the colorbar to the figure with matplotlib
The road to compiling to Python 3 with Thrift
Try to use up the Raspberry Pi 2's 4-core CPU with Parallel Python
Try to solve the fizzbuzz problem with Keras
Log in to the remote server with SSH
A memorandum to make WebDAV only with nginx
The easiest way to get started with Django
Crop the image to rounded corners with pythonista
How to specify the NIC to scan with amazon-dash
2016 The University of Tokyo Mathematics Solved with Python
I tried to save the data with discord
The easiest way to synthesize speech with python
Try to solve the man-machine chart with Python
Specify the Python executable to use with virtualenv
I wanted to play with the Bezier curve
How to try the friends-of-friends algorithm with pyfof
Say hello to the world with Python with IntelliJ
The easiest way to use OpenCV with python
Save the object to a file with pickle
Back up from QNAP to Linux with rsync
How to Learn Kaldi with the JUST Corpus
I tried to learn the sin function with chainer
The easiest way to set up Last-Modified in Flask
How to delete the specified string with the sed command! !! !!
Add information to the bottom of the figure with Matplotlib
Just add the driver to the shape key with blender
[Introduction to Python] How to iterate with the range function?
How to create a submenu with the [Blender] plugin
Try to visualize the room with Raspberry Pi, part 1
Try to solve the internship assignment problem with Python
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
[Python] How to specify the download location with youtube-dl
Display the integrated temperature for each field with Z-GIS
Introduction to Mathematics Starting with Python Study Memo Vol.1
I want to inherit to the back with python dataclass
Try to get the contents of Word with Golang
[Neo4J] ④ Try to handle the graph structure with Cypher
PyInstaller memorandum Convert Python [.py] to [.exe] with 2 lines
Specify MinGW as the compiler to use with Python
Transit to the update screen with the Django a tag
I tried to solve the problem with Python Vol.1
[Python] How to rewrite the table style with python-pptx [python-pptx]
Display / update the graph according to the input with PySimpleGui
Try to specify the axis with PyTorch's Softmax function
I wrote you to watch the signal with Go