集合運算計算機(聯集與交集)
輸入兩個元素集合,即時計算它們的聯集、交集、差集、對稱差及所有基數。
運算
Number of elements in the result set
7
totalA only
42.9%
A ∩ B
28.6%
B only
28.6%
- 1
|A|
5 - 2
|B|
4 - 3
|A ∩ B| (shared elements)
2 - 4
|A ∪ B| = |A| + |B| − |A ∩ B|
5 + 4 − 2 = 7Inclusion–exclusion: subtract the overlap to avoid counting it twice.
此計算機如何運作?
輸入兩個集合並選擇運算。工具去除重複項後返回聯集、交集、單側差集或對稱差,以及每個集合的基數。文氏圖式的甜甜圈圖將聯集分割為僅屬於 A、共有和僅屬於 B 的元素,讓您直觀看到兩個集合的重疊情況。
公式
How this is calculated
在兩個文字框中分別輸入集合 A 和集合 B 的元素。元素可以用逗號、空格或換行分隔,任何重複的元素都會被合併,使每個集合只含唯一元素——與集合的數學定義完全吻合。比較基於每個元素的字面文字,因此「2」和「2.0」被視為不同元素。
計算機建立五個衍生集合。聯集 A ∪ B 包含出現在任一集合中的所有元素。交集 A ∩ B 包含兩個集合共有的元素。差集 A ∖ B 保留 A 中不屬於 B 的元素,而 B ∖ A 則反之。對稱差 A △ B 合併兩個單側差集——恰好屬於兩個集合之一的元素。運算選擇器決定顯示哪個作為主要結果。
基數直接由此得出:|A|、|B|、|A ∪ B|、|A ∩ B| 和 |A △ B| 是相應集合的元素計數。根據容斥原理,|A ∪ B| = |A| + |B| − |A ∩ B|。甜甜圈圖將聯集分割為三個不相交區域——僅在 A 中的元素、兩者共有的元素和僅在 B 中的元素——這是標準的兩圓文氏圖分解。若兩個框均為空,結果未定義;允許單個集合為空,結果為空集 { }。
常見問題
使用逗號、空格或換行——任意組合均可。例如「1, 2 3\n4」會被讀取為四個元素。
不。集合只保存唯一元素,因此同一框內重複出現的元素在任何運算前都會合併為單一元素。
A △ B 是恰好屬於兩個集合之一的元素集合:(A ∖ B) ∪ (B ∖ A)。其大小等於 |A ∪ B| − |A ∩ B|。
也稱為
TG we-Calculate Editorial Team. (2026). 集合運算計算機(聯集與交集) [Online calculator]. TG we-Calculate. https://we-calculate.com/zh-tw/calculator/set-operations-calculator
TG we-Calculate Editorial Team. "集合運算計算機(聯集與交集)." TG we-Calculate. 2026. https://we-calculate.com/zh-tw/calculator/set-operations-calculator.
TG we-Calculate Editorial Team, "集合運算計算機(聯集與交集)," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/zh-tw/calculator/set-operations-calculator
@misc{wecalculate_set_operations_calculator, title = {集合運算計算機(聯集與交集)}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/zh-tw/calculator/set-operations-calculator}}, year = {2026}, note = {TG we-Calculate} }
這個計算機對您有幫助嗎?
