def ns_implicit_mid(): global x_nsimp x_nsimp = np.array([x0, xp0]) traj = x_nsimp for i in range(1, steps + 1): x_new = fs(NSIMP, x_nsimp) traj = np.vstack([traj, x_new]) x_nsimp = x_new return traj
def getpoint_spline(dist, tck): x = fs(getlengthfromspline,0.0,(tck,dist))[0] return x,interpolate.splev(x,tck,der=0)
def getpoint_spline(dist,tck): x = fs(getlengthfromspline,0.0,(tck,dist))[0] #fs is a solver. It solves for dist_spline = #req_dist return x,interpolate.splev(x,tck,der=0).item()
def d_to_x_old( self, length, start_x ): #Bad idea! The solver is calling splev more than required. x_l = fs(lambda x: self.x_to_d(start_x, x) - length, self.road_x[0]) return x_l
def calcu(): ##########初始化坐标########## global R1 R1 = float(e_CIRCLE_1.get()) global R2 R2 = float(e_CIRCLE_2.get()) global R3 R3 = float(e_CIRCLE_3.get()) global R4 R4 = float(e_CIRCLE_4.get()) global CIRCLE_1 CIRCLE_1 = Circle(0, 3, R1) global CIRCLE_4 CIRCLE_4 = Circle(21, 43, R4) global POINT_A global POINT_P global POINT_B global POINT_C POINT_A = Point(float(e_POINT_A_X.get()), float(e_POINT_A_Y.get())) POINT_P = Point(float(e_POINT_P_X.get()), float(e_POINT_P_Y.get())) POINT_B = Point(float(e_POINT_B_X.get()), float(e_POINT_B_Y.get())) POINT_C = Point(float(e_POINT_C_X.get()), float(e_POINT_C_Y.get())) ##########得到M点的坐标########## global POINT_M POINT_M = fs(qiedian, [1, 1]) POINT_M = Point(POINT_M[0], POINT_M[1]) ##########求LINE1和LINE2########## global LINE_1 ## 全局变量必须设置在方法体内部 LINE_1 = lineBy2Point(POINT_M, POINT_C, 1) LINE_1.sayHello(1) global LINE_2 LINE_2 = lineBy2Point(POINT_C, POINT_B, 2) LINE_2.sayHello(2) ##########求CIRCLE2和CIRCLE3########## R2_cicle = fs( solve_circle_2, [1, 1], ) global CIRCLE_2 CIRCLE_2 = Circle(R2_cicle[0], R2_cicle[1], 15) CIRCLE_2.sayHello(2) R3_cicle = fs(solve_circle_3, [1, 1]) global CIRCLE_3 CIRCLE_3 = Circle(R3_cicle[0], R3_cicle[1], 3) CIRCLE_3.sayHello(3) ################# 交点 ################# global POINT_E POINT_E = Point(0, 3) POINT_E.sayHello("E") POINT_M.sayHello("M") global POINT_N POINT_N = fs(line1ToCircle2, [1, 1]) POINT_N = Point(POINT_N[0], POINT_N[1]) POINT_N.sayHello("N") global POINT_L POINT_L = fs(line2ToCircle2, [1, 1]) POINT_L = Point(POINT_L[0], POINT_L[1]) POINT_L.sayHello("L") global POINT_Y POINT_Y = fs(line2ToCircle3, [1, 1]) POINT_Y = Point(POINT_Y[0], POINT_Y[1]) POINT_Y.sayHello("Y") global POINT_X POINT_X = fs(line3ToCircle3, [1, 1]) POINT_X = Point(POINT_X[0], POINT_X[1]) POINT_X.sayHello("X") ################# 临界面积 ################# print "\n现在开始求积分:" SUIWEI = e_suiwei.get() area = client(float(SUIWEI)) lable1 = Label(root, text="面积是:" + str(float(area))) lable1.pack()
def getpoint_spline(dist, tck): x = fs(getlengthfromspline, 0.0, (tck, dist))[0] return x, interpolate.splev(x, tck, der=0)
def d_to_x_old(self,length,start_x): #Bad idea! The solver is calling splev more than required. x_l = fs(lambda x: self.x_to_d(start_x,x) - length,self.road_x[0]) return x_l