def right_side(p): """ Nonlinear side of the integral equation. """ if Principial_Value: return integratus(lambda x:f_bracket(x)*K(x,p)-f_bracket(pole)*K_residue(pole,p)/(x-pole),0.,L)[0]+f_bracket(pole)*K_residue(pole,p)*log(L/pole - 1) else: return integratus(lambda x:f_bracket(x)*K(x,p),0.,L)[0]
def iterate(): global solution, G3, iteration iteration+=1 psi=interpolate([0.]+psi_range, [G3]+solution.tolist()) new_solution=[] for i,p in enumerate(psi_range): new_solution.append(integratus(lambda k:K(k,p)*psi(k),0.,L-dx/2.)[0]+b[i]) solution=np.array(new_solution) G3=G3_proper()
def rescale(factor): global solution, L psi=interpolate([0.]+psi_range, [G3]+solution.tolist()) old_L=L L=L*factor define_ranges() new_solution=[] for p in psi_range: new_solution.append(integratus(lambda k:K(k,p)*psi(k),0.,old_L-dx/2.)[0]+right_side(p)) solution=np.array(new_solution)
def G3_proper(): psi=interpolate([0.]+psi_range, [G3]+solution.tolist()) return integratus(lambda k:K(k,0.)*psi(k),0.,L)[0]+right_side(0.)