请告诉我如何在python中实现图1所示的积分(或代码中的第18-19行)?
通过 sympy.integrate 尝试但失败 - ValueError: Invalid limits specified: (20.665,)
import numpy as np
import sympy
from scipy import interpolate
b_2 = 6.67
l_k = 24.0
U_1 = [0.0, 4.3, 8.1, 11.4, 14.1, 16.3, 18.0, 19.3, 20.2, 20.7]
V_1 = [0.0, 0.6, 1.8, 3.5, 5.7, 8.3, 11.3, 14.8, 18.6, 22.8]
"The first derivative of the centroid equation"
def Cn_1(x):
x_points = U_1
y_points = V_1
tck = interpolate.splrep(x_points, y_points)
return interpolate.splev(x, tck, der = 1)
"Calculating the length of the centroid depending on the X coordinate "
def l_cn(x):
return sympy.integrate((1 + Cn_1(x)**2)**0.5, x)
"Full centroid length"
L_max = l_cn(l_k - 0.5 * b_2)
print("L_max = ", L_max)