I am finding errors with the last line of the for loop where I am trying to update the curve value to a list containing the curve value iterations. I get errors like "can only concatenate tuple (not "float) to tuple" and "tuple object has no attribute 'append'". Does anyone know a way to do this? Thank you...
import matplotlib.pyplot as plt
thetaR = 0.078
thetaS = 0.43
alpha = 0.0036
psiRange = (range(0,1000))
#psi = 1
#psi = (0,1000)
n = 1.56
curveList = ()
for psi in psiRange:
curve = (thetaR) + ((thetaS - thetaR)/((1 + (alpha*psi**n))**(1-1/n)))
#curveList.append(curve)
curveList += curve
plt.plot(curveList)
plt.axis(0,1,0,100)
plt.show()
You can't append to a
tuple
at all (tuple
s are immutable), and extending to alist
with+
requires another list.Make
curveList
alist
by declaring it with:and use:
to add an element to the end of it. Or (less good because of the intermediate
list
object created):