基于这道数学题:kuing.cjhb.site/forum.php?mod=redirect&goto=findpost&ptid=12514&pid=60461
$$\max\{\min\{a,b\},\min\{c,d\}\}
=\min\{\max\{a,c\},\max\{b,d\}\}$$
这对于所有 a,b,c,d 都成立吗?
大多数情况下都是成立。但是,也有一些组合不成立,例如:
- \( (1, 3, 4, 2) \)
- \( (1, 4, 3, 2) \)
- \( (2, 3, 4, 1) \)
- \( (2, 4, 3, 1) \)
- \( (3, 1, 2, 4) \)
- \( (3, 2, 1, 4) \)
- \( (4, 1, 2, 3) \)
- \( (4, 2, 1, 3) \)
- import itertools
- # Function to compute the left-hand side of the equation
- def lhs(a, b, c, d):
- return max(min(a, b), min(c, d))
- # Function to compute the right-hand side of the equation
- def rhs(a, b, c, d):
- return min(max(a, c), max(b, d))
- # Verify for all possible combinations of a, b, c, d where a, b, c, d are distinct integers
- values = [1, 2, 3, 4]
- all_combinations = list(itertools.permutations(values, 4))
- # Check all combinations
- results = []
- for combo in all_combinations:
- a, b, c, d = combo
- if lhs(a, b, c, d) == rhs(a, b, c, d):
- results.append((a, b, c, d, True))
- else:
- results.append((a, b, c, d, False))
- results
复制代码 这表明,虽然该方程在许多情况下成立,但它并不适用于 a、b、c、d 的所有可能组合。 |