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