SHARE
TWEET

Untitled

a guest Sep 18th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from pt4 import *
  2. import sys
  3. step=0.1
  4. def FunctionMax(x1,x2):
  5.     return 2*x1*x1*x1+x2*x1+x2
  6.  
  7. #func_list=list()
  8.  
  9.  
  10. def FindMax(step):
  11.     F_max=-sys.maxsize
  12.     x1=0
  13.     x2=-2
  14.     while x1 <= 2:
  15.         x2=-2
  16.         while x2 <= 4:
  17.             #temp_list=list()
  18.             y=FunctionMax(x1, x2)
  19.             if y>F_max:
  20.                 F_max=y
  21.                 #temp_list.append(x1)
  22.                 #temp_list.append(x2)
  23.                 #temp_list.append(y)
  24.                 #func_list.append(temp_list)
  25.         x2=x2+step
  26.     x1=x1+step
  27.     return F_max
  28.    
  29. res=FindMax(step)
  30. print(res,'\n')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top