Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. from pt4 import *
  2. import sys
  3. from math import pow
  4. step=0.008
  5. def FunctionMax(x1,x2):
  6. return 2*pow(x1,3)+x2*x1+x2
  7.  
  8. func_list=list()
  9.  
  10.  
  11. def FindMax(step):
  12. F_max=-sys.maxsize
  13. x1=0
  14. x2=-2
  15. while x1 <= 2:
  16. x2=-2
  17. while x2 <= 4:
  18. temp_list=list()
  19. y=FunctionMax(x1, x2)
  20. if y>F_max:
  21. F_max=y
  22. temp_list.append(x1)
  23. temp_list.append(x2)
  24. temp_list.append(y)
  25. func_list.append(temp_list)
  26. x2=x2+step
  27. x1=x1+step
  28. return F_max
  29.  
  30. res=FindMax(step)
  31. print(res,'\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement