我有这个代码,我想计算 0 < t < pi with 0.05 step, but each new function is a function of the previous one, and I can't really think of an easy way to iterate over it, any tips?
wf_0 = get_wf_0(xmin, xmax, Nx, neigs, t=0) #Ignore this since it's another function
wf_1 = get_wf(xmin, xmax, Nx, neigs, t=0.05 , wf = wf_0)
wf_2 = get_wf(xmin, xmax, Nx, neigs, t=0.1 , wf = wf_1)
wf_3 = get_wf(xmin, xmax, Nx, neigs, t=0.15 , wf = wf_2)
依此类推直到 t = pi
基本上可以这样完成:
wf = get_wf_0(xmin, xmax, Nx, neigs, t=0)
for s in range(1, math.pi // 0.05):
wf = get_wf(xmin, xmax, Nx, neigs, t=0.05 * s , wf = wf)