test.py 436 B

12345678910111213141516171819
  1. import numpy as np
  2. from scipy.optimize import minimize
  3. # 定义目标函数
  4. def objective_function(x):
  5. return (x[0]-0.5)**2 + (x[1]-0.1)**2
  6. if __name__=='__main__':
  7. # # 初始猜测值
  8. # initial_guess = np.array([2, 2])
  9. # # 使用minimize函数进行优化
  10. # result = minimize(objective_function, initial_guess)
  11. # print(result)
  12. a=20
  13. b=18
  14. print(f'Hello-{hex(a)}')
  15. print(f'Hello-%x-%4d' %(a,b))