def gy(x, y): a, Delta, N = readParameters.readParameters() s = 0 for k in range(1, N+1): c = (0.5 + N - k) * x + y s += (1 + c**2)**(-1.5) return s
def f(alpha, beta): a, Delta, N = readParameters.readParameters() s = 0 for k in range(1, N + 1): s = s + 1 / np.sqrt(1 + ((0.5 + N - k) * alpha + beta)**2) s = s - a / Delta return s
def main(): a, Delta, N = rps.readParameters() x0 = 0.5 y0 = -3 v = newton.newton(x0, y0) x, y = createCurve.createCurve(v) plt.plot(x, y, "b-o") plt.grid() plt.xlim(min(x) - 0.05, max(x) + 0.05) plt.ylim(min(y) - 0.05, max(y) + 0.05) plt.show() return 0
def createCurve(v): a, Delta, N = readParameters.readParameters() x = [] y = [] theta = [] for k in range(1, N + 1): theta.append(np.arctan((0.5 + N - k) * v[0] + v[1])) sx = 0 sy = 0 x.append(sx) y.append(sy) for i in range(len(theta)): sx = sx + Delta * np.cos(theta[i]) sy = sy + Delta * np.sin(theta[i]) x.append(sx) y.append(-abs(sy)) return x, y