2sin30°在python中如何表示_如何在python中实现以下派生公式?
我嘗試在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
有點不正確,因為它沒有給我正確的結果。我想我在計算前兩行的導數時犯了一些錯誤。我該怎么解決呢?在
以下是數據幀中的一些點:
^{pr2}$
在得到導數后,我使用以下代碼將導數x_prim、x_prim、y_prim、y_prim_prim放入另一個數據幀中:d = pd.DataFrame({'x_prim': pts_x, 'y_prim': pts_y, 'x_prim_prim': pts_xx, 'y_prim_prim':pts_yy})
在數據幀中包含所有內容后,我將為數據幀的每一行調用函數,以使用以下代碼獲得該點的曲率:# Getting the curvature at each point
for i in range(len(d)):
temp = d.iloc[i]
c_temp = f(temp)
curv.append(c_temp)
總結
以上是生活随笔為你收集整理的2sin30°在python中如何表示_如何在python中实现以下派生公式?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql链路跟踪工具_SkyWalki
- 下一篇: python二进制文件的读取与写入可以分