我正在使用由FactorList
函数生成的 Mathematica 列表,看起来像
t = {{-1, 1}, {q, 1}, {P[41, 42], 1}, {P[41, 43], 1}, {P[42, 43], 1}}
我想搜索这个列表,确定位置中的哪些元素[i][1]
(其中 i 是 t 中第 i 个集合的位置)的形式P[a,b]
为 a,b 是整数。
有没有办法测试一个元素是否符合一般形式P[integer, integer]
,以便在 valueq
元素 t[[2][1]] 上运行此测试会返回False
并运行它P[41,43]
会返回True
?