I have a problem. I am trying to build a function for different values d. I defined das:
d = np.arange(0.0, 100.0, 0.01)
But I still get the same error:
TypeError: only length-1 arrays can be converted to Python scanners
This is my script:
import pylab
import numpy as np
import scipy
import matplotlib.pyplot as plt
import math
from scipy.optimize import curve_fit
import numpy
def teo_function(d):
return 2*math.pi*math.sqrt(((1**2)/(12+d**2))/9.81*d)
d = np.arange(0.0, 100.0, 0.01)
T = teo_function(d)
pylab.plot (d,teo_function(d), 'bo', d, teo_function(d), 'k')
pylab.show()
Thank you all for your help.
source
share