def onecurvepoint(p0): tol=1e-4 while True: df = polynomial_spline.df(p0) p1 = p0 - polynomial_spline.f(p0)*df/dot(df,df) dif = p1-p0 if sqrt(dot(dif,dif))<tol: return p1 else: p0=p1
def onecurvepoint(p0): tol = 1e-4 while True: df = polynomial_spline.df(p0) p1 = p0 - polynomial_spline.f(p0) * df / dot(df, df) dif = p1 - p0 if sqrt(dot(dif, dif)) < tol: return p1 else: p0 = p1
def curvepoint(p0): tol=1e-4 while True: df1 = polynomial_spline.df(p0); f1 = polynomial_spline.f(p0) df2 = array([2*p0[0],2*p0[1],2*p0[2]]); f2 = p0[0]**2+p0[1]**2+p0[2]**2-Rn**2 df1df2 = dot(df1,df2); df1df1 = dot(df1,df1); df2df2 = dot(df2,df2) beta = (-f1+f2*df1df1/df1df2)/(df1df2-df1df1*df2df2/df1df2) alpha = (-f1+f2*df1df2/df2df2)/(df1df1-df1df2*df1df2/df2df2) dk = alpha*df1+beta*df2 p1 = p0+dk dif = p1-p0 if sqrt(dot(dif,dif))<tol: return p1 else: p0=p1
def curvepoint(p0): tol = 1e-4 while True: df1 = polynomial_spline.df(p0) f1 = polynomial_spline.f(p0) df2 = array([2 * p0[0], 2 * p0[1], 2 * p0[2]]) f2 = p0[0]**2 + p0[1]**2 + p0[2]**2 - Rn**2 df1df2 = dot(df1, df2) df1df1 = dot(df1, df1) df2df2 = dot(df2, df2) beta = (-f1 + f2 * df1df1 / df1df2) / (df1df2 - df1df1 * df2df2 / df1df2) alpha = (-f1 + f2 * df1df2 / df2df2) / (df1df1 - df1df2 * df1df2 / df2df2) dk = alpha * df1 + beta * df2 p1 = p0 + dk dif = p1 - p0 if sqrt(dot(dif, dif)) < tol: return p1 else: p0 = p1