Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role of xk and xkp1 in jacobi_step #59

Open
anders34 opened this issue Apr 24, 2016 · 4 comments
Open

Role of xk and xkp1 in jacobi_step #59

anders34 opened this issue Apr 24, 2016 · 4 comments
Labels

Comments

@anders34
Copy link

anders34 commented Apr 24, 2016

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
Copy link

mvelegar commented Apr 24, 2016

@ 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
Copy link
Author

anders34 commented Apr 24, 2016

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
Copy link
Author

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

@cswiercz cswiercz reopened this Apr 25, 2016
@cswiercz
Copy link
Member

Reopened since another student might find this discussion useful.

@cswiercz cswiercz changed the title Numpy Arrays Role of xk and xkp1 in jacobi_step Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants