uwhpsc-2016 / homework1

Homework #1
1 stars 1 forks source link

Role of `xk` and `xkp1` in `jacobi_step` #59

Open anders34 opened 8 years ago

anders34 commented 8 years ago

For Exercise 3, for jacobi_step, when we make our xkp1 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 setting xkp1 equal to xk and changing it later, but xk holds ints and I need xkp1 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.

mvelegar commented 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.

anders34 commented 8 years ago

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.

anders34 commented 8 years ago

Never mind! I figured out a way to do it!

cswiercz commented 8 years ago

Reopened since another student might find this discussion useful.