我我定义的第一功能,工程如何使用我定义的新函数中定义的函数?
def chainPoints(aa,DIS,SEG,H):
#xtuple
n=0
xterms = []
xterm = -DIS
while n<=SEG:
xterms.append(xterm)
n+=1
xterm = -DIS + n*SEGL
#
#ytuple
k=0
yterms = []
while k<=SEG:
yterm = H + aa*m.cosh(xterms[k]/aa) - aa*m.cosh(DIS/aa)
yterms.append(yterm)
k+=1
但现在我需要依赖于我的第一个功能,speciffically名单的xterm和yterms第二功能。
def chainLength(aa,DIS,SEG,H):
chainPoints(aa,DIS,SEG,H)
#length of chain
ff=1
Lterm=0.
totallength=0.
while ff<=SEG:
Lterm = m.sqrt((xterms[ff]-xterms[ff-1])**2 + (yterms[ff]-yterms[ff-1])**2)
totallength += Lterm
ff+=1
return(totallength)
我已经完成了所有没有定义的功能,但现在我需要为每个部分定义函数。
你为什么只是用我的答案更新你的问题?你是说你已经这么做了,还是你有跟进问题?如果是这样,请不要*通过更新您的问题来使答案无效。 –
对不起,有人告诉我以前更新问题。仍然是一个noob –