我正在尝试在python中为X和Y点实现以下公式
我尝试了以下方法
def f(c):
"""This function computes the curvature of the leaf."""
tt = c
n = (tt[0]*tt[3] - tt[1]*tt[2])
d = (tt[0]**2 + tt[1]**2)
k = n/d
R = 1/k # Radius of Curvature
return R
Run Code Online (Sandbox Code Playgroud)
有一些不正确的东西,因为它不能给我正确的结果。我认为在前两行中计算导数时犯了一些错误。我该如何解决?
以下是数据框中的一些要点:
pts = pd.DataFrame({'x': x, 'y': y})
x y
0.089631 97.710199
0.089831 97.904541
0.090030 98.099313
0.090229 98.294513
0.090428 98.490142
0.090627 98.686200
0.090827 98.882687
0.091026 99.079602
0.091225 99.276947
0.091424 99.474720
0.091623 99.672922
0.091822 99.871553
0.092022 100.070613
0.092221 100.270102
0.092420 100.470020
0.092619 100.670366
0.092818 …Run Code Online (Sandbox Code Playgroud) 我在3D空间中有3个点,我想在3D中定义一个穿过这些点的平面.
X Y Z
0 0.65612 0.53440 0.24175
1 0.62279 0.51946 0.25744
2 0.61216 0.53959 0.26394
Run Code Online (Sandbox Code Playgroud)
另外我需要在3D空间中绘制它.
我有一个数据帧,我想将该数据帧划分为宽度相等的容器(每个容器中的数据点数量可能不相同)。我尝试过以下方法
df = pc13.sort_values(by = ['A'], ascending=True)
df_temp = np.array_split(df, 20)
Run Code Online (Sandbox Code Playgroud)
但这种方法将数据帧划分为具有相同数据点数量的箱。相反,我想将数据帧划分为特定宽度的容器,而且每个容器中的数据点数量也可能不同。
数据帧 A 列中的最小值为 -0.04843731030699292,最大值为 0.05417013917000033。我尝试上传整个数据框,但它是非常大的文件。
python-3.x ×2
binning ×1
derivative ×1
geometry ×1
math ×1
matplotlib ×1
mplot3d ×1
pandas ×1
python ×1