Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- c1 = 90
- c2 = 12
- arr = [0.02, 0.09, 0.15, 0.25, 0.30, 0.32, 0.36, 0.45, 0.50, 0.54, 0.58, 0.60]
- sum_pt = [0]
- for i in range(len(arr)):
- sum_pt.append(sum_pt[-1] + arr[i])
- print(sum_pt)
- carr = []
- # "{:.2f}".format(a_float)
- for i in range(len(arr)):
- value = (sum_pt[i] * c1 + c2) * 100. / (i + 1.)
- carr.append(value)
- for i in range(len(arr)):
- sum_i_pt = "{:5.2f}".format(sum_pt[i])
- arr_i = "{:5.2f}".format(arr[i])
- carr_i_fmt = "{:5.2f}".format(carr[i])
- index = "{:2d}".format(i + 1)
- print(f"T = {index}, P(t) = {arr_i}, Sum(P(t)) = {sum_i_pt}, C(T) = {carr_i_fmt}")
- index_arr = []
- for i in range(len(arr)):
- index_arr.append(i + 1)
- plt.plot(index_arr, carr)
- plt.xlabel("Months")
- plt.ylabel("Costs")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement