0

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!

1
  • how did you create X ? Commented Oct 12, 2015 at 6:58

1 Answer 1

3

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")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.