如何解决反导积分
请告诉我如何在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)
Image of a piece of code written in MathCad 2000 that I am trying to port to Python
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。