2sin30°在python中如何表示_如何在python中实现以下派生公式?
我嘗試在python中實(shí)現(xiàn)以下關(guān)于X和Y點(diǎn)的公式
我嘗試過以下方法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
有點(diǎn)不正確,因?yàn)樗鼪]有給我正確的結(jié)果。我想我在計(jì)算前兩行的導(dǎo)數(shù)時(shí)犯了一些錯(cuò)誤。我該怎么解決呢?在
以下是數(shù)據(jù)幀中的一些點(diǎn):
^{pr2}$
在得到導(dǎo)數(shù)后,我使用以下代碼將導(dǎo)數(shù)x_prim、x_prim、y_prim、y_prim_prim放入另一個(gè)數(shù)據(jù)幀中:d = pd.DataFrame({'x_prim': pts_x, 'y_prim': pts_y, 'x_prim_prim': pts_xx, 'y_prim_prim':pts_yy})
在數(shù)據(jù)幀中包含所有內(nèi)容后,我將為數(shù)據(jù)幀的每一行調(diào)用函數(shù),以使用以下代碼獲得該點(diǎn)的曲率:# Getting the curvature at each point
for i in range(len(d)):
temp = d.iloc[i]
c_temp = f(temp)
curv.append(c_temp)
總結(jié)
以上是生活随笔為你收集整理的2sin30°在python中如何表示_如何在python中实现以下派生公式?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql链路跟踪工具_SkyWalki
- 下一篇: java javafx webview_