SymmetricDifference

SymmetricDifference[list1,list2,]

给出列表 listi 的对称差.

更多信息和选项

  • SymmetricDifference[list1,list2] 给出在 list1list2 中但不同时在两者中的元素的排序后的列表.
  • SymmetricDifference[list1,list2,] 给出在奇数个 listi 中出现的元素的排序后的列表.
  • listi 必须有相同的标头,但不必是 List.
  • SymmetricDifference[list1,list2,,SameTesttest]listi 中的每对元素应用 test,以确定是否应将其视为等同.

范例

打开所有单元关闭所有单元

基本范例  (2)

返回仅存在于其中一个列表中的元素:

返回在奇数个列表中出现的元素:

范围  (1)

使用任何标头相同的表达式:

选项  (1)

SameTest  (1)

默认情况下,SymmetricDifference 执行 SameQ 比较:

Equal 比较数字:

属性和关系  (6)

SymmetricDifference[] 返回 {}

SymmetricDifference[list,{}] 返回 list

SymmetricDifference[l1,l2] 返回与 SymmetricDifference[l2,l1] 一样的元素:

SymmetricDifference[l1,l2] 等价于 Union[Complement[l1,l2],Complement[l2,l1]]

SymmetricDifference[l1,l2] 等价于 Complement[Union[l1,l2],Intersection[l1,l2]]

SymmetricDifference[l1,l2,] 返回在奇数个列表中出现的元素:

UniqueElements[{l1,l2,}]返回只在其中一个列表中出现的元素:

Wolfram Research (2022),SymmetricDifference,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SymmetricDifference.html.

文本

Wolfram Research (2022),SymmetricDifference,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SymmetricDifference.html.

CMS

Wolfram 语言. 2022. "SymmetricDifference." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/SymmetricDifference.html.

APA

Wolfram 语言. (2022). SymmetricDifference. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/SymmetricDifference.html 年

BibTeX

@misc{reference.wolfram_2024_symmetricdifference, author="Wolfram Research", title="{SymmetricDifference}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/SymmetricDifference.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_symmetricdifference, organization={Wolfram Research}, title={SymmetricDifference}, year={2022}, url={https://reference.wolfram.com/language/ref/SymmetricDifference.html}, note=[Accessed: 22-November-2024 ]}