'Why do I get "ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')" with values from raw_input
I am trying to create a really simple program that will plot a plot a parabola where v is velocity, a is acceleration and x is time. The user will input values for v and a, then v and a and x will determine y.
I attempted to do this with this:
x = np.linspace(0., 9., 10)
a = raw_input('Acceleration =')
v = raw_input('Velocity = ')
y = v * x - 0.5 * a * x**2.
But, I keep getting this error:
TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')
What does this mean?
Solution 1:[1]
I faced this problem recently, change the dtype of x to something specific by doing:
x = np.asarray(x, dtype='float64')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | logicb0mb |
