Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- from tabulate import tabulate
- function1_ = 20
- function2_ = 10
- def function1(x):
- return 20 + 6 * x - 3 * x // 2
- def function2(x):
- return 9 * math.log1p(x) + 9
- def calculate(start, end, step):
- result = []
- x = start
- while x <= end:
- res1 = function1(x)/function1_
- res2 = function2(x)/function2_
- res3 = max(res1, res2)
- res4 = min(res1,res2)
- result.append([res1, res2, res3, res4])
- x += step
- return result
- def main():
- result = calculate(2, 5, 0.001)
- min_max = result[0][2]
- max_min = result[0][3]
- for index in range(len(result)):
- min_max = min(result[index][2], min_max)
- max_min = max(result[index][3], max_min)
- print(tabulate(result, headers=['f1/f1*', 'f2/f2*', 'max(Fi/Fi*)', 'min(Fi/Fi*)']))
- print("min max(Fi/Fi*) = {}".format(min_max))
- print("max min(Fi/Fi*) = {}".format(max_min))
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement