Reputation: 3
I'm trying to construct a basic program for matrix manipulation to solve the iterable Gauss equations. To do that I'm using these data sets:
x = np.array([0.125, 0.25, 0.375, 0.5])
y = np.array([166, 144, 128, 120])
b = np.array([190,3])
And filling my main array as follows:
X[0:4,0] = np.exp(-b[1]*x[:])
X[0:4,1] = -b[0]*x[:]*np.exp(-b[1]*x[:])
When they are plugged in without the matrix, both code pieces return floats, which I need, but when put into X they switch to integers. I have done quite a bit of searching and I can't find a solution to this problem. I am a beginner so it wouldn't surprise me if this is something very simple, I've just run out of places to look. Thank you!
Upvotes: 0
Views: 64
Reputation: 243
When you created your X array, supposing you are giving him a size since you don't append anything, did you try just to precise the type ?
X = np.array((4,1), dtype="float32")
Upvotes: 3