亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

python Spyder 交互式輸出

python Spyder 交互式輸出

慕無忌1623718 2023-05-16 16:53:35
最近我寫了這段代碼,試圖找到一些方法來計算拋物線的積分,但現在對我來說這不是任何問題,但關鍵是我寫的代碼沒有給我任何輸出,這很奇怪我使用 spyder 和代碼如下:def integrator(a,b,c):    #a,b and c are the factors of the quadratic    import numpy as np    delta=((b**2)-4*a*c)    answer1= (-b+delta)/2    answer2=(-b-delta)/2     #it gets the answers of the quadratic eruation and uses them as the lower and upper bounds    if delta<=0:        return "this func has no real answer"    if delta==0:        return "this function has two equal answers"        return  answer1  else:      return answer1      return answer2  #it also calculate the answers of the quadratic equation too  integ_range=[]  for i in np.arange(answer1,answer2,0.01):      integ_range.append(i)  for i in integ_range:      heights=(a*(i**2))+(b*i)+c  sum1=sum(integ_range)      integrate=sum1*0.01  return (integrate)integrator(1,2,3)我的代碼的描述和未給出的輸出
查看完整描述

1 回答

?
MYYA

TA貢獻1868條經驗 獲得超4個贊

將變量分配給積分器為:


i=integrator(1,2,-3)

print(i)

那應該有用


查看完整回答
反對 回復 2023-05-16
  • 1 回答
  • 0 關注
  • 196 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號