Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在给定范围 [a,z] 内找到已定义函数 f(x) 的最大值。a < z。将有 n+1 个大小相等的样本(在函数中输入 n)。我还想在相同的条件下找到 f(x) 的平均值。我应该如何着手解决这个问题?
尝试这个:
maximum = max(map(lambda x: -f(x), my_list) //or maximum = max(x, key=lambda l: -f(l)) average = sum(my_list)/len(my_list)