0
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.integrate import quad
lo = input("What is your lower bound")
up = input("What is your upper bound")
def f(x):
return equation
i= int(quad(f(x), lo, up))
while True:
if i < 0:
print ("invalid")
elif i.isalpha:
print("invalid")
elif i == "":
print("invalid")
else:
print("invalid")
print(i[0])
lo = float(input("What is your lower bound"))
up = float(input("What is your upper bound"))
기본적으로
, input()
반환 문자열이 오류
TypeError Traceback (most recent call last)
<ipython-input-76-9a1a8ce0b385> in <module>()
11 return equation
12
---> 13 i= int(quad(f(x), lo, up))
14
15 while True:
~/anaconda3/lib/python3.6/site-packages/scipy/integrate/quadpack.py in quad(func, a, b, args, full_output, epsabs, epsrel, limit, points, weight, wvar, wopts, maxp1, limlst)
321 if (weight is None):
322 retval = _quad(func, a, b, args, full_output, epsabs, epsrel, limit,
--> 323 points)
324 else:
325 retval = _quad_weight(func, a, b, args, full_output, epsabs, epsrel,
~/anaconda3/lib/python3.6/site-packages/scipy/integrate/quadpack.py in _quad(func, a, b, args, full_output, epsabs, epsrel, limit, points)
386 if points is None:
387 if infbounds == 0:
--> 388 return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
389 else:
390 return _quadpack._qagie(func,bound,infbounds,args,full_output,epsabs,epsrel,limit)
**TypeError: must be real number, not str**
방정식이란 무엇입니까? – roganjosh
다음 번에 오류 메시지를 읽으십시오 - '** TypeError : 실수가 아니고 str **이어야합니다.'- 변수에서 값을 확인하여 어느 문자열이 유지되는지 확인하십시오. 'print (변수, 타입 (변수))' – furas