# Python Code
import numpy as np # Python强大的numpy模块搞定基本函数
from scipy import interpolate # Python强大的scipy模块搞定插值
# 定义设计曲线 (Rm/F1=1.0)
# List x=td/T
# List y=Ym/Yel
x=[0.11312,0.17313,0.2571,0.4074,0.58394,0.79807,1.0504,1.3964,
1.773,2.3566,2.685,3.0976,3.3961,3.7356,4.2567,4.8228,5.6064,
6.2329,6.5401,6.8434,7.2125,7.8135,8.7628,9.8677,]
y=[0.29923,0.45155,0.6526,0.9747,1.2727,1.5763,1.834,2.1859,2.1054,
1.5665,1.2086,0.946,0.9265,1.0447,1.2724,1.3661,1.0901,0.9006,
0.8756,0.9799,1.122,1.2672,1.3025,1.1459,]
# 定义二次样条插值函数
f=interpolate.interp1d(x,y,kind='quadratic')
# 定义基本参数
td=0.04
KLM_e=0.78
KLM_p=0.66
Mt=154
k=10233662
# 定义初始迭代的u
u=1.8
# 定义迭代函数
def iteration(u_old): # define iteration function
KLM = (KLM_e + (u_old-1)*KLM_p)/u_old
T = 2*np.pi*(KLM*Mt/k)**0.5
tau = td/T
u_new = f(tau)
return u_new
# 调用循环体来迭代
while True:
UU = iteration(u)
if np.abs((UU-u)/u)<=0.001: # Set 0.1% as criteria
break # stop iteration if criteria is fulfilled
else:
u = UU # update u and continue the iteration
continue
print (u) # 打印结果,u=1.99