Open anders34 opened 8 years ago
@ anders34 You need not store all the values of the gradient algorithm iterates, so you should not need an array/list. You can just use two variables xk and xkp1 for the current and next guess respectively, these will get rewritten every time jacobi_step
is called till convergence.
I'm talking about xk
and xkp1
themselves. Aren't we trying to solve something of the form Ax=b, which means x
is a vector/array? Even part 3 says xk
should be given as a Numpy array.
Never mind! I figured out a way to do it!
Reopened since another student might find this discussion useful.
For Exercise 3, for
jacobi_step
, when we make ourxkp1
array, since it has to be a numpy array and you said that the things you've already imported should be enough, that makes me think we should use the array function to make it. But we don't know what goes in the array yet, so we can't do that. So then I tried just settingxkp1
equal toxk
and changing it later, butxk
holds ints and I needxkp1
to hold floats and I don't know how to change it. So I don't know if the issue is with creating the array, or if it's about changing an array of ints to an array of floats.