我有以下功能:
f(x) = (x2 + x1x3x5)(x4 + x3x5x6)(x5 + x6)
我怎样才能使表达式像:
f(x) = x1x2x3 + x2x3x4 + ...
出这个?有什么方法吗?
我不确定 SO 是否是发布此内容的正确位置...我想不是,但我仍然找到了标签和大约 100 个帖子,所以我在这里:P
我有以下功能:
f(x) = (x2 + x1x3x5)(x4 + x3x5x6)(x5 + x6)
我怎样才能使表达式像:
f(x) = x1x2x3 + x2x3x4 + ...
出这个?有什么方法吗?
我不确定 SO 是否是发布此内容的正确位置...我想不是,但我仍然找到了标签和大约 100 个帖子,所以我在这里:P
干得好:
(x2x4x5 + x1x3x5)(x4x6) + (x2x5 + x1x3x5)(x3x5x6)
(x2x4x5x6 + x1x3x4x5x6) + (x2x5 + x1x3x5)(x3x5x6)
x2x4x5x6 + x1x3x4x5x6 + x2x3x5x6 + x1x3x5x6
x2x4x5x6 + x1x3(x4x5x6 + x5x6) + x2x3x5x6
x2x5x6(x4+1) + x1x3(x4x5x6 + x5x6)
x2x4x5x6 + x1x3(x5x6(x4+1))
x2x4x5x6 + x1x3(x4x5x6)
x2x4x5x6 + x1x3x4x5x6
(x2+x1x3)x4x5x6
我可能在某个地方犯了一个错误,所以你应该先测试一下。
您的原件:
f(x) = (x2 + x1x3x5)(x4 + x3x5x6)(x5 + x6)
现在使用一些简单的数学:
f(x) = (x2x4 + x2x3x5x6 + x1x3x5x4 + x1x3x5x3x5x6)(x5 + x6)
f(x) = x2x4x5 + x2x3x5x6x5 + x1x3x5x4x5 + x1x3x5x3x5x6x5 + x2x4x6 + x2x3x5x6x6 + x1x3x5x4x6 + x1x3x5x3x5x6x6
简化为我们提供了答案(尽管不一定更短),
f(x) = x2x4x5 + x2x3x5x6 + x1x3x5x4x5 + x1x3x5x6 + x2x4x6 + x2x3x5x6 + x1x3x5x4x6 + x1x3x5x6
据我记得布尔代数,您可以将它们作为普通数字相乘。所以 (x2 + x1x3x5)(x5 + x6) 将是 x2x5 + x2x6 + x1x3x5x5 + x1x3x5x6。但据我所知,这仅适用于“AND”而不适用于“OR”
嗯,这看起来更像是一道数学题。
但是,如果我正确理解了您想要的内容,它将看起来像这样
x2x4x5+x2x4x6+x2x3x5x6x5+x2x3x5x6x6+x1x3x5x4 ext.
基本上 (a1+a2)a3=a1a3+a2a3 (a1+a2)(a3+a4)=a1a3+a1a4+a2a3+a3a4